diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-08-14 11:28:53 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-16 12:41:44 +0100 |
commit | 5f256f104f98ac0aba1234d0dadac4a1f9602e11 (patch) | |
tree | 655730ae12bcf9a988201608276f288f4a179845 /spec/controllers/request_controller_spec.rb | |
parent | 90fa58ceb1bdb0f7932ff99d44b7f14710dfc261 (diff) |
Refactor expectation into a method
Remove expectation of pdf contents - we're looking at the raw file.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 8631b51cf..32d79ab5a 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -826,6 +826,12 @@ end describe RequestController, "when handling prominence" do + def expect_hidden_attachment(hidden_template) + response.content_type.should == "text/html" + response.should render_template(hidden_template) + response.code.should == '410' + end + context 'when the request is hidden' do before(:each) do @@ -863,10 +869,7 @@ describe RequestController, "when handling prominence" do :part => 2, :file_name => 'interesting.pdf', :skip_cache => 1 - response.content_type.should == "text/html" - response.should_not contain "thisisthebody" - response.should render_template('request/hidden') - response.code.should == '410' + expect_hidden_attachment('request/hidden') end it 'should not generate an HTML version of an attachment for a request whose prominence @@ -886,8 +889,7 @@ describe RequestController, "when handling prominence" do context 'when the request is requester_only' do before(:each) do - @info_request = FactoryGirl.create(:info_request_with_attachments, - prominence: 'requester_only') + @info_request = FactoryGirl.create(:info_request_with_attachments, prominence: 'requester_only') end it "should not show request if you're not logged in" do |