diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 14 | ||||
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 18ccbba7e..a0ea9bb48 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -39,6 +39,11 @@ describe RequestController, "when listing recent requests" do assigns[:list_results].size.should == 1 end + it "should make a sane-sized cache tag" do + get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' + assigns[:cache_tag].size.should <= 32 + end + it "should list internal_review requests as unresolved ones" do get :list, :view => 'awaiting' assigns[:list_results].size.should == 0 @@ -190,6 +195,15 @@ describe RequestController, "when showing one request" do get :get_attachment_as_html, :incoming_message_id => ir.incoming_messages[1].id, :id => ugly_id, :part => 2, :file_name => ['hello.txt.html'], :skip_cache => 1 }.should raise_error(ActiveRecord::RecordNotFound) end + it "should return 404 when incoming message and request ids don't match " do + ir = info_requests(:fancy_dog_request) + wrong_id = info_requests(:naughty_chicken_request).id + receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email) + ir.reload + lambda { + get :get_attachment_as_html, :incoming_message_id => ir.incoming_messages[1].id, :id => wrong_id, :part => 2, :file_name => ['hello.txt.html'], :skip_cache => 1 + }.should raise_error(ActiveRecord::RecordNotFound) + end it "should generate valid HTML verson of PDF attachments " do ir = info_requests(:fancy_dog_request) diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 1e25c1b44..a90fa18df 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -543,6 +543,13 @@ describe UserController, "when using profile photos" do post :set_profile_photo, { :id => @user.id, :file => @uploadedfile, :submitted_draft_profile_photo => 1, :automatically_crop => 1 } end + it "should return a 404 not a 500 when a profile photo has not been set" do + @user.profile_photo.should be_nil + lambda { + get :get_profile_photo, {:url_name => @user.url_name } + }.should raise_error(ActiveRecord::RecordNotFound) + end + it "should let you change profile photo if you're logged in as the user" do @user.profile_photo.should be_nil session[:user_id] = @user.id |