aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_batch_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/info_request_batch_spec.rb')
-rw-r--r--spec/models/info_request_batch_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/models/info_request_batch_spec.rb b/spec/models/info_request_batch_spec.rb
index 7f6905c8e..2323c3bd3 100644
--- a/spec/models/info_request_batch_spec.rb
+++ b/spec/models/info_request_batch_spec.rb
@@ -29,31 +29,33 @@ end
describe InfoRequestBatch, "when finding an existing batch" do
before do
+ @first_body = FactoryGirl.create(:public_body)
+ @second_body = FactoryGirl.create(:public_body)
@info_request_batch = FactoryGirl.create(:info_request_batch, :title => 'Matched title',
- :body => 'Matched body')
- @first_request = FactoryGirl.create(:info_request, :info_request_batch => @info_request_batch)
- @second_request = FactoryGirl.create(:info_request, :info_request_batch => @info_request_batch)
+ :body => 'Matched body',
+ :public_bodies => [@first_body,
+ @second_body])
end
it 'should return a batch with the same user, title and body sent to one of the same public bodies' do
InfoRequestBatch.find_existing(@info_request_batch.user,
@info_request_batch.title,
@info_request_batch.body,
- [@first_request.public_body_id]).should_not be_nil
+ [@first_body]).should_not be_nil
end
it 'should not return a batch with the same title and body sent to another public body' do
InfoRequestBatch.find_existing(@info_request_batch.user,
@info_request_batch.title,
@info_request_batch.body,
- [FactoryGirl.create(:public_body).id]).should be_nil
+ [FactoryGirl.create(:public_body)]).should be_nil
end
it 'should not return a batch sent the same public bodies with a different title and body' do
InfoRequestBatch.find_existing(@info_request_batch.user,
'Other title',
'Other body',
- [@first_request.public_body_id]).should be_nil
+ [@first_body]).should be_nil
end
it 'should not return a batch sent to one of the same public bodies with the same title and body by