diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-17 10:32:36 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-17 10:41:21 +0000 |
commit | 610eac0af6f8faf426b46f14ecbe9a312b428bb0 (patch) | |
tree | f7bb8eca3cec984238ba9cd20786b6d21dd7e2f5 /spec/controllers/request_controller_spec.rb | |
parent | 4a42afb6feaca5f3ed81ae6a64d29e273a52039b (diff) |
Rewrite specs that were in spec/controller/application_controller as full-stack controller specs in the relevant controllers. It turns out that having spec blocks that reference the ApplicationController class directly i.e. "describe ApplicationController" can have unpredictable effects. actionpack's action_controller/test_case.rb rewrites rescue_action_without_handler on whatever it is included in, and if this is done on a controller class, and then directly on action controller, it can result in an infinite loop of recursive calls. This turns out to be the problem that was causing some tests in error_spec.rb to fail in Travis under Ruby 1.9.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 521ad7b5a..7cfa5cb4a 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -2313,4 +2313,31 @@ describe RequestController, "when reporting a request (logged in)" do end end +describe RequestController, "when caching fragments" do + + it "should not fail with long filenames" do + long_name = "blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah.txt" + info_request = mock(InfoRequest, :user_can_view? => true, + :all_can_view? => true) + incoming_message = mock(IncomingMessage, :info_request => info_request, + :parse_raw_email! => true, + :info_request_id => 132, + :get_attachments_for_display => nil, + :html_mask_stuff! => nil) + attachment = mock(FoiAttachment, :display_filename => long_name, + :body_as_html => ['some text', 'wrapper']) + IncomingMessage.stub!(:find).with("44").and_return(incoming_message) + IncomingMessage.stub!(:get_attachment_by_url_part_number).and_return(attachment) + InfoRequest.stub!(:find).with("132").and_return(info_request) + params = { :file_name => [long_name], + :controller => "request", + :action => "get_attachment_as_html", + :id => "132", + :incoming_message_id => "44", + :part => "2" } + get :get_attachment_as_html, params + end + +end + |