From 282cebc96cb9548e5af3f2ee7c635c39da4bdbce Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 24 Sep 2013 18:14:35 +0100 Subject: Add a batch_request_template flag A virtual attribute to use to customise some info request behaviours when we are using one request as a template for creating multiple requests. --- spec/models/info_request_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/models') diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index dcc94e967..be9206ad1 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -46,6 +46,19 @@ describe InfoRequest do info_request.valid? info_request.errors[:title].should_not be_empty end + + it 'should require a public body id by default' do + info_request = InfoRequest.new + info_request.valid? + info_request.errors[:public_body_id].should_not be_empty + end + + it 'should not require a public body id if it is a batch request template' do + info_request = InfoRequest.new + info_request.is_batch_request_template = true + info_request.valid? + info_request.errors[:public_body_id].should be_empty + end end describe 'when generating a user name slug' do -- cgit v1.2.3