diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 49 | ||||
-rw-r--r-- | spec/controllers/request_game_controller_spec.rb | 3 | ||||
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 5 | ||||
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 3 |
4 files changed, 52 insertions, 8 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 1a190cad6..514eda0b4 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -8,7 +8,7 @@ require 'json' describe RequestController, "when listing recent requests" do - before(:all) do + before(:each) do rebuild_xapian_index end @@ -35,11 +35,14 @@ describe RequestController, "when listing recent requests" do end end - describe RequestController, "when showing one request" do fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views - + + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should be successful" do get :show, :url_title => 'why_do_you_have_such_a_fancy_dog' response.should be_success @@ -198,6 +201,10 @@ end describe RequestController, "when changing prominence of a request" do fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should not show hidden requests" do ir = info_requests(:fancy_dog_request) ir.prominence = 'hidden' @@ -457,7 +464,11 @@ end describe RequestController, "when viewing an individual response for reply/followup" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views - + + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should ask for login if you are logged in as wrong person" do session[:user_id] = users(:silly_name_user).id get :show_response, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message) @@ -489,6 +500,7 @@ describe RequestController, "when classifying an information request" do @dog_request = info_requests(:fancy_dog_request) @dog_request.stub!(:is_old_unclassified?).and_return(false) InfoRequest.stub!(:find).and_return(@dog_request) + load_raw_emails_data(raw_emails) end def post_status(status) @@ -898,7 +910,11 @@ end describe RequestController, "sending overdue request alerts" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views - + + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should send an overdue alert mail to creators of overdue requests" do chicken_request = info_requests(:naughty_chicken_request) chicken_request.outgoing_messages[0].last_sent_at = Time.now() - 30.days @@ -982,7 +998,11 @@ end describe RequestController, "sending unclassified new response reminder alerts" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views - + + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should send an alert" do RequestMailer.alert_new_response_reminders @@ -1009,7 +1029,10 @@ end describe RequestController, "clarification required alerts" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views - + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should send an alert" do ir = info_requests(:fancy_dog_request) ir.set_described_state('waiting_clarification') @@ -1060,6 +1083,9 @@ end describe RequestController, "comment alerts" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views + before(:each) do + load_raw_emails_data(raw_emails) + end it "should send an alert (once and once only)" do # delete ficture comment and make new one, so is in last month (as @@ -1131,7 +1157,10 @@ end describe RequestController, "when viewing comments" do integrate_views - fixtures :users + fixtures :users, :raw_emails, :incoming_messages, :info_requests + before(:each) do + load_raw_emails_data(raw_emails) + end it "should link to the user who submitted it" do session[:user_id] = users(:bob_smith_user).id @@ -1240,6 +1269,10 @@ describe RequestController, "when showing JSON version for API" do fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should return data in JSON form" do get :show, :url_title => 'why_do_you_have_such_a_fancy_dog', :format => 'json' diff --git a/spec/controllers/request_game_controller_spec.rb b/spec/controllers/request_game_controller_spec.rb index ce507fad1..4883bfdd6 100644 --- a/spec/controllers/request_game_controller_spec.rb +++ b/spec/controllers/request_game_controller_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe RequestGameController, "when playing the game" do fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views + before(:each) do + load_raw_emails_data(raw_emails) + end it "should show the game homepage" do get :play diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 0a8919268..f7002a9d4 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -37,6 +37,9 @@ describe TrackController, "when sending alerts for a track" do integrate_views fixtures :info_requests, :outgoing_messages, :incoming_messages, :raw_emails, :info_request_events, :users, :track_things, :track_things_sent_emails, :public_bodies, :public_body_translations include LinkToHelper # for main_url + before(:each) do + load_raw_emails_data(raw_emails) + end before do rebuild_xapian_index @@ -100,6 +103,7 @@ describe TrackController, "when viewing RSS feed for a track" do before do rebuild_xapian_index + load_raw_emails_data(raw_emails) end it "should get the RSS feed" do @@ -125,6 +129,7 @@ describe TrackController, "when viewing JSON version of a track feed" do before do rebuild_xapian_index + load_raw_emails_data(raw_emails) end it "should get the feed" do diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index c6817fbc6..0b5e96711 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -8,6 +8,9 @@ require 'json' describe UserController, "when showing a user" do integrate_views fixtures :users, :outgoing_messages, :incoming_messages, :raw_emails, :info_requests, :info_request_events, :comments, :public_bodies, :public_body_translations + before(:each) do + load_raw_emails_data(raw_emails) + end it "should be successful" do get :show, :url_name => "bob_smith" |