diff options
Diffstat (limited to 'spec/models/info_request_spec.rb')
-rw-r--r-- | spec/models/info_request_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index ade75e2cc..9766f928f 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 @@ -600,6 +613,12 @@ describe InfoRequest do @info_request.apply_censor_rules_to_text!(@text) end + it 'should not raise an error if the request is a batch request template' do + @info_request.stub!(:public_body).and_return(nil) + @info_request.is_batch_request_template = true + lambda{ @info_request.apply_censor_rules_to_text!(@text) }.should_not raise_error + end + end context 'when applying censor rules to binary files' do |