#3178: impediment spec blocks_ids

* array/string/integer
pull/6827/head
Jens Ulferts 14 years ago
parent f389dfd978
commit f664e85503
  1. 41
      spec/models/impediment_spec.rb

@ -34,6 +34,14 @@ describe Impediment do
:old_status => issue_status1, :old_status => issue_status1,
:new_status => issue_status2, :new_status => issue_status2,
:role => role) } :role => role) }
let(:impediment) { Factory.build(:impediment, :author => user,
:fixed_version => version,
:assigned_to => user,
:priority => issue_priority,
:project => project,
:tracker => tracker_task,
:status => issue_status1,
:blocks_ids => feature.id.to_s)}
before(:each) do before(:each) do
Setting.plugin_redmine_backlogs = {:points_burn_direction => "down", Setting.plugin_redmine_backlogs = {:points_burn_direction => "down",
@ -140,15 +148,7 @@ describe Impediment do
before(:each) do before(:each) do
feature.fixed_version = version feature.fixed_version = version
feature.save feature.save
@impediment = Factory.create(:impediment, @impediment = impediment
:author => user,
:fixed_version => version,
:assigned_to => user,
:priority => issue_priority,
:project => project,
:tracker => tracker_task,
:status => issue_status1,
:blocks_ids => feature.id.to_s)
@impediment.save @impediment.save
end end
@ -228,5 +228,28 @@ describe Impediment do
it { @impediment.errors[:blocks_ids].should eql I18n.t(:must_block_at_least_one_issue, :scope => [:activerecord, :errors, :models, :impediment, :attributes, :blocks_ids]) } it { @impediment.errors[:blocks_ids].should eql I18n.t(:must_block_at_least_one_issue, :scope => [:activerecord, :errors, :models, :impediment, :attributes, :blocks_ids]) }
end end
end end
describe "blocks_ids=/blocks_ids" do
describe "WITH an integer" do
it do
impediment.blocks_ids = 2
impediment.blocks_ids.should eql [2]
end
end
describe "WITH a string" do
it do
impediment.blocks_ids = "1, 2, 3"
impediment.blocks_ids.should eql [1,2,3]
end
end
describe "WITH an array" do
it do
impediment.blocks_ids = [1,2,3]
impediment.blocks_ids.should eql [1,2,3]
end
end
end
end end
end end
Loading…
Cancel
Save