diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin_censor_rule_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/admin_general_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/admin_public_body_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/controllers/admin_request_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/controllers/admin_track_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/admin_user_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/api_controller_spec.rb | 134 | ||||
-rw-r--r-- | spec/controllers/comment_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/general_controller_spec.rb | 54 | ||||
-rw-r--r-- | spec/controllers/help_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 14 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 45 | ||||
-rw-r--r-- | spec/controllers/services_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 8 | ||||
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 18 |
15 files changed, 180 insertions, 131 deletions
diff --git a/spec/controllers/admin_censor_rule_controller_spec.rb b/spec/controllers/admin_censor_rule_controller_spec.rb index 8893a858b..c4860da3f 100644 --- a/spec/controllers/admin_censor_rule_controller_spec.rb +++ b/spec/controllers/admin_censor_rule_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminCensorRuleController, "when making censor rules from the admin interface" do - integrate_views + render_views before { basic_auth_login @request } it "should create a censor rule and purge the corresponding request from varnish" do diff --git a/spec/controllers/admin_general_controller_spec.rb b/spec/controllers/admin_general_controller_spec.rb index dc1eb0d97..b0b65857f 100644 --- a/spec/controllers/admin_general_controller_spec.rb +++ b/spec/controllers/admin_general_controller_spec.rb @@ -4,7 +4,7 @@ describe AdminGeneralController do describe "when viewing front page of admin interface" do - integrate_views + render_views before { basic_auth_login @request } it "should render the front page" do diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index 504ddc5cc..c1d3f5014 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminPublicBodyController, "when administering public bodies" do - integrate_views + render_views before do @old_filters = ActionController::Routing::Routes.filters @@ -154,7 +154,7 @@ end describe AdminPublicBodyController, "when administering public bodies and paying attention to authentication" do - integrate_views + render_views before do config = MySociety::Config.load_default() @@ -263,7 +263,7 @@ describe AdminPublicBodyController, "when administering public bodies and paying end describe AdminPublicBodyController, "when administering public bodies with i18n" do - integrate_views + render_views it "shows the index page" do get :index @@ -288,7 +288,7 @@ describe AdminPublicBodyController, "when administering public bodies with i18n" end it "saves edits to a public body" do - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do pb = PublicBody.find(id=3) pb.name.should == "El Department for Humpadinking" post :update, { @@ -308,10 +308,10 @@ describe AdminPublicBodyController, "when administering public bodies with i18n" end pb = PublicBody.find(public_bodies(:humpadink_public_body).id) - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do pb.name.should == "Renamed" end - PublicBody.with_locale(:en) do + I18n.with_locale(:en) do pb.name.should == "Department for Humpadinking" end end @@ -325,7 +325,7 @@ describe AdminPublicBodyController, "when administering public bodies with i18n" end describe AdminPublicBodyController, "when creating public bodies with i18n" do - integrate_views + render_views before do @old_filters = ActionController::Routing::Routes.filters @@ -357,12 +357,12 @@ describe AdminPublicBodyController, "when creating public bodies with i18n" do body = PublicBody.find_by_name("New Quango") body.translations.map {|t| t.locale.to_s}.sort.should == ["en", "es"] - PublicBody.with_locale(:en) do + I18n.with_locale(:en) do body.name.should == "New Quango" body.url_name.should == "new_quango" body.first_letter.should == "N" end - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do body.name.should == "Mi Nuevo Quango" body.url_name.should == "mi_nuevo_quango" body.first_letter.should == "M" diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb index 8a3934685..0709f6b0b 100644 --- a/spec/controllers/admin_request_controller_spec.rb +++ b/spec/controllers/admin_request_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminRequestController, "when administering requests" do - integrate_views + render_views before { basic_auth_login @request } before(:each) do @@ -82,7 +82,7 @@ describe AdminRequestController, "when administering requests" do end describe AdminRequestController, "when administering the holding pen" do - integrate_views + render_views before(:each) do basic_auth_login @request load_raw_emails_data diff --git a/spec/controllers/admin_track_controller_spec.rb b/spec/controllers/admin_track_controller_spec.rb index 728c79f1f..f2de6c0d3 100644 --- a/spec/controllers/admin_track_controller_spec.rb +++ b/spec/controllers/admin_track_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminTrackController, "when administering tracks" do - integrate_views + render_views it "shows the list page" do get :list diff --git a/spec/controllers/admin_user_controller_spec.rb b/spec/controllers/admin_user_controller_spec.rb index cf3665c9f..a6e5a0d7e 100644 --- a/spec/controllers/admin_user_controller_spec.rb +++ b/spec/controllers/admin_user_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe AdminUserController, "when administering users" do - integrate_views + render_views it "shows the index/list page" do get :index diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb index 8d8a39950..1c320f85c 100644 --- a/spec/controllers/api_controller_spec.rb +++ b/spec/controllers/api_controller_spec.rb @@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') def normalise_whitespace(s) - s = s.gsub(/^\s+|\s+$/, "") + s = s.gsub(/\A\s+|\s+\Z/, "") s = s.gsub(/\s+/, " ") return s end @@ -14,23 +14,36 @@ Spec::Matchers.define :be_equal_modulo_whitespace_to do |expected| end describe ApiController, "when using the API" do - it "should check the API key" do - request_data = { + + describe 'checking API keys' do + before do + @number_of_requests = InfoRequest.count + @request_data = { "title" => "Tell me about your chickens", "body" => "Dear Sir,\n\nI should like to know about your chickens.\n\nYours in faith,\nBob\n", - + "external_url" => "http://www.example.gov.uk/foi/chickens_23", "external_user_name" => "Bob Smith", } - - number_of_requests = InfoRequest.count + end + + it 'should check that an API key is given as a param' do expect { - post :create_request, :k => "This is not really an API key", :request_json => request_data.to_json + post :create_request, :request_json => @request_data.to_json }.to raise_error ApplicationController::PermissionDenied - - InfoRequest.count.should == number_of_requests + InfoRequest.count.should == @number_of_requests + end + + it "should check the API key" do + expect { + post :create_request, + :k => "This is not really an API key", + :request_json => @request_data.to_json + }.to raise_error ApplicationController::PermissionDenied + InfoRequest.count.should == @number_of_requests + end end - + it "should create a new request from a POST" do number_of_requests = InfoRequest.count( :conditions => [ @@ -38,61 +51,61 @@ describe ApiController, "when using the API" do public_bodies(:geraldine_public_body).id ] ) - + request_data = { "title" => "Tell me about your chickens", "body" => "Dear Sir,\n\nI should like to know about your chickens.\n\nYours in faith,\nBob\n", - + "external_url" => "http://www.example.gov.uk/foi/chickens_23", "external_user_name" => "Bob Smith", } - + post :create_request, :k => public_bodies(:geraldine_public_body).api_key, :request_json => request_data.to_json response.should be_success response.content_type.should == "application/json" - + response_body = ActiveSupport::JSON.decode(response.body) response_body["errors"].should be_nil response_body["url"].should =~ /^http/ - + InfoRequest.count(:conditions => [ "public_body_id = ?", public_bodies(:geraldine_public_body).id] ).should == number_of_requests + 1 - + new_request = InfoRequest.find(response_body["id"]) new_request.user_id.should be_nil new_request.external_user_name.should == request_data["external_user_name"] new_request.external_url.should == request_data["external_url"] - + new_request.title.should == request_data["title"] new_request.last_event_forming_initial_request.outgoing_message.body.should == request_data["body"].strip - + new_request.public_body_id.should == public_bodies(:geraldine_public_body).id end - + def _create_request post :create_request, :k => public_bodies(:geraldine_public_body).api_key, :request_json => { "title" => "Tell me about your chickens", "body" => "Dear Sir,\n\nI should like to know about your chickens.\n\nYours in faith,\nBob\n", - + "external_url" => "http://www.example.gov.uk/foi/chickens_23", "external_user_name" => "Bob Smith", }.to_json response.content_type.should == "application/json" return ActiveSupport::JSON.decode(response.body)["id"] end - + it "should add a response to a request" do # First we need an external request request_id = info_requests(:external_request).id - + # Initially it has no incoming messages IncomingMessage.count(:conditions => ["info_request_id = ?", request_id]).should == 0 - + # Now add one sent_at = "2012-05-28T12:35:39+01:00" response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n" @@ -104,13 +117,13 @@ describe ApiController, "when using the API" do "sent_at" => sent_at, "body" => response_body }.to_json - + # And make sure it worked response.should be_success incoming_messages = IncomingMessage.all(:conditions => ["info_request_id = ?", request_id]) incoming_messages.count.should == 1 incoming_message = incoming_messages[0] - + incoming_message.sent_at.should == Time.iso8601(sent_at) incoming_message.get_main_body_text_folded.should be_equal_modulo_whitespace_to(response_body) end @@ -118,10 +131,10 @@ describe ApiController, "when using the API" do it "should add a followup to a request" do # First we need an external request request_id = info_requests(:external_request).id - + # Initially it has one outgoing message OutgoingMessage.count(:conditions => ["info_request_id = ?", request_id]).should == 1 - + # Add another, as a followup sent_at = "2012-05-29T12:35:39+01:00" followup_body = "Pls answer ASAP.\nkthxbye\n" @@ -133,7 +146,7 @@ describe ApiController, "when using the API" do "sent_at" => sent_at, "body" => followup_body }.to_json - + # Make sure it worked response.should be_success followup_messages = OutgoingMessage.all( @@ -141,15 +154,15 @@ describe ApiController, "when using the API" do ) followup_messages.size.should == 1 followup_message = followup_messages[0] - + followup_message.last_sent_at.should == Time.iso8601(sent_at) followup_message.body.should == followup_body.strip end - + it "should not allow internal requests to be updated" do n_incoming_messages = IncomingMessage.count n_outgoing_messages = OutgoingMessage.count - + request_id = info_requests(:naughty_chicken_request).id post :add_correspondence, :k => public_bodies(:geraldine_public_body).api_key, @@ -159,20 +172,20 @@ describe ApiController, "when using the API" do "sent_at" => Time.now.iso8601, "body" => "xxx" }.to_json - + response.status.should == "500 Internal Server Error" ActiveSupport::JSON.decode(response.body)["errors"].should == [ "Request #{request_id} cannot be updated using the API"] - + IncomingMessage.count.should == n_incoming_messages OutgoingMessage.count.should == n_outgoing_messages end - + it "should not allow other people's requests to be updated" do request_id = _create_request n_incoming_messages = IncomingMessage.count n_outgoing_messages = OutgoingMessage.count - + post :add_correspondence, :k => public_bodies(:humpadink_public_body).api_key, :id => request_id, @@ -181,15 +194,15 @@ describe ApiController, "when using the API" do "sent_at" => Time.now.iso8601, "body" => "xxx" }.to_json - + response.status.should == "500 Internal Server Error" ActiveSupport::JSON.decode(response.body)["errors"].should == [ "You do not own request #{request_id}"] - + IncomingMessage.count.should == n_incoming_messages OutgoingMessage.count.should == n_outgoing_messages end - + it "should not allow files to be attached to a followup" do post :add_correspondence, :k => public_bodies(:geraldine_public_body).api_key, @@ -202,21 +215,21 @@ describe ApiController, "when using the API" do :attachments => [ fixture_file_upload("files/tfl.pdf") ] - - + + # Make sure it worked response.status.to_i.should == 500 errors = ActiveSupport::JSON.decode(response.body)["errors"] errors.should == ["You cannot attach files to messages in the 'request' direction"] end - + it "should allow files to be attached to a response" do # First we need an external request request_id = info_requests(:external_request).id - + # Initially it has no incoming messages IncomingMessage.count(:conditions => ["info_request_id = ?", request_id]).should == 0 - + # Now add one sent_at = "2012-05-28T12:35:39+01:00" response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n" @@ -231,34 +244,33 @@ describe ApiController, "when using the API" do :attachments => [ fixture_file_upload("files/tfl.pdf") ] - + # And make sure it worked response.should be_success incoming_messages = IncomingMessage.all(:conditions => ["info_request_id = ?", request_id]) incoming_messages.count.should == 1 incoming_message = incoming_messages[0] - + incoming_message.sent_at.should == Time.iso8601(sent_at) incoming_message.get_main_body_text_folded.should be_equal_modulo_whitespace_to(response_body) - + # Get the attachment attachments = incoming_message.get_attachments_for_display attachments.size.should == 1 attachment = attachments[0] - attachment.filename.should == "tfl.pdf" - attachment.body.should == load_file_fixture("tfl.pdf") + attachment.body.should == load_file_fixture("tfl.pdf", as_binary=true) end - + it "should show information about a request" do info_request = info_requests(:naughty_chicken_request) get :show_request, :k => public_bodies(:geraldine_public_body).api_key, :id => info_request.id - + response.should be_success assigns[:request].id.should == info_request.id - + r = ActiveSupport::JSON.decode(response.body) r["title"].should == info_request.title # Let’s not test all the fields here, because it would @@ -266,13 +278,13 @@ describe ApiController, "when using the API" do # assigns them and changing assignment to an equality # check, which does not really test anything at all. end - + it "should show an Atom feed of new request events" do get :body_request_events, :id => public_bodies(:geraldine_public_body).id, :k => public_bodies(:geraldine_public_body).api_key, :feed_type => "atom" - + response.should be_success response.should render_template("api/request_events.atom") assigns[:events].size.should > 0 @@ -288,7 +300,7 @@ describe ApiController, "when using the API" do :id => public_bodies(:geraldine_public_body).id, :k => public_bodies(:geraldine_public_body).api_key, :feed_type => "json" - + response.should be_success assigns[:events].size.should > 0 assigns[:events].each do |event| @@ -296,13 +308,13 @@ describe ApiController, "when using the API" do event.outgoing_message.should_not be_nil event.event_type.should satisfy {|x| ['sent', 'followup_sent', 'resent', 'followup_resent'].include?(x)} end - + assigns[:event_data].size.should == assigns[:events].size assigns[:event_data].each do |event_record| event_record[:event_type].should satisfy {|x| ['sent', 'followup_sent', 'resent', 'followup_resent'].include?(x)} end end - + it "should honour the since_event_id parameter" do get :body_request_events, :id => public_bodies(:geraldine_public_body).id, @@ -311,7 +323,7 @@ describe ApiController, "when using the API" do response.should be_success first_event = assigns[:event_data][0] second_event_id = assigns[:event_data][1][:event_id] - + get :body_request_events, :id => public_bodies(:geraldine_public_body).id, :k => public_bodies(:geraldine_public_body).api_key, @@ -320,14 +332,14 @@ describe ApiController, "when using the API" do response.should be_success assigns[:event_data].should == [first_event] end - + it "should honour the since_date parameter for the Atom feed" do get :body_request_events, :id => public_bodies(:humpadink_public_body).id, :k => public_bodies(:humpadink_public_body).api_key, :since_date => "2010-01-01", :feed_type => "atom" - + response.should be_success response.should render_template("api/request_events.atom") assigns[:events].size.should > 0 @@ -335,7 +347,7 @@ describe ApiController, "when using the API" do event.created_at.should >= Date.new(2010, 1, 1) end end - + it "should return a JSON 404 error for non-existent requests" do request_id = 123459876 # Let's hope this doesn't exist! sent_at = "2012-05-28T12:35:39+01:00" @@ -351,7 +363,7 @@ describe ApiController, "when using the API" do response.status.should == "404 Not Found" ActiveSupport::JSON.decode(response.body)["errors"].should == ["Could not find request 123459876"] end - + it "should return a JSON 500 error if we try to add correspondence to a request we don't own" do request_id = info_requests(:naughty_chicken_request).id sent_at = "2012-05-28T12:35:39+01:00" diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb index 4a7acee23..c03615ce2 100644 --- a/spec/controllers/comment_controller_spec.rb +++ b/spec/controllers/comment_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe CommentController, "when commenting on a request" do - integrate_views + render_views it "should give an error and render 'new' template when body text is just some whitespace" do post :new, :url_title => info_requests(:naughty_chicken_request).url_title, diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index 830486493..9684732a5 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -35,7 +35,7 @@ end describe GeneralController, "when showing the frontpage" do - integrate_views + render_views before do public_body = mock_model(PublicBody, :name => "Example Public Body", @@ -97,8 +97,57 @@ describe GeneralController, "when showing the frontpage" do response.should be_success end + describe 'when there is more than one locale' do + + describe 'when using the default locale' do + + before do + @default_lang_home_link = /href=".*\/en\// + @other_lang_home_link = /href=".*\/es\// + @old_include_default_locale_in_urls = Configuration::include_default_locale_in_urls + end + + def set_default_locale_in_urls(value) + Configuration.stub!(:include_default_locale_in_urls).and_return(value) + load Rails.root.join("config/initializers/fast_gettext.rb") + end + + describe 'when the config value INCLUDE_DEFAULT_LOCALE_IN_URLS is false' do + + before do + set_default_locale_in_urls(false) + end + + it 'should generate URLs without a locale prepended' do + get :frontpage + response.should_not have_text(@default_lang_home_link) + end + + it 'should render the front page in the default language when no locale param + is present and the session locale is not the default' do + get(:frontpage, {}, {:locale => 'es'}) + response.should_not have_text(@other_lang_home_link) + end + end + + it 'should generate URLs with a locale prepended when the config value + INCLUDE_DEFAULT_LOCALE_IN_URLS is true' do + set_default_locale_in_urls(true) + get :frontpage + response.should have_text(@default_lang_home_link) + end + + after do + set_default_locale_in_urls(@old_include_default_locale_in_urls) + end + + end + end + + describe "when using different locale settings" do home_link_regex = /href=".*\/en\// + it "should generate URLs with a locale prepended when there's more than one locale set" do get :frontpage response.should have_text(home_link_regex) @@ -137,6 +186,7 @@ describe GeneralController, "when showing the frontpage" do FastGettext.default_available_locales = old_fgt_available_locales I18n.available_locales = old_i18n_available_locales end + end end describe GeneralController, "when showing the front page with fixture data" do @@ -185,7 +235,7 @@ end describe GeneralController, 'when using xapian search' do - integrate_views + render_views # rebuild xapian index after fixtures loaded before(:each) do diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index 28fd08c80..0f6f75eb9 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe HelpController, "when using help" do - integrate_views + render_views it "shows the about page" do get :about diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 29ece18cb..a0841b621 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe PublicBodyController, "when showing a body" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -44,14 +44,14 @@ describe PublicBodyController, "when showing a body" do end it "should assign the body using different locale from that used for url_name" do - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do get :show, {:url_name => "dfh", :view => 'all'} assigns[:public_body].notes.should == "Baguette" end end it "should assign the body using same locale as that used in url_name" do - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do get :show, {:url_name => "edfh", :view => 'all'} assigns[:public_body].notes.should == "Baguette" end @@ -79,7 +79,7 @@ describe PublicBodyController, "when showing a body" do end describe PublicBodyController, "when listing bodies" do - integrate_views + render_views it "should be successful" do get :list @@ -87,7 +87,7 @@ describe PublicBodyController, "when listing bodies" do end it "should list all bodies from default locale, even when there are no translations for selected locale" do - PublicBody.with_locale(:en) do + I18n.with_locale(:en) do @english_only = PublicBody.new(:name => 'English only', :short_name => 'EO', :request_email => 'english@flourish.org', @@ -95,7 +95,7 @@ describe PublicBodyController, "when listing bodies" do :last_edit_comment => '') @english_only.save end - PublicBody.with_locale(:es) do + I18n.with_locale(:es) do get :list assigns[:public_bodies].include?(@english_only).should == true end @@ -193,7 +193,7 @@ end describe PublicBodyController, "when doing type ahead searches" do - integrate_views + render_views before(:each) do load_raw_emails_data diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index e898fb91b..9e14153a7 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -59,19 +59,6 @@ describe RequestController, "when listing recent requests" do :conditions => "id in (select info_request_id from info_request_events where created_at between '2007-10-13'::date and '2007-11-01'::date)") 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 vary the cache tag with locale" do - get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' - en_tag = assigns[:cache_tag] - session[:locale] = :es - get :list, :view => 'all', :request_date_after => '13/10/2007', :request_date_before => '01/11/2007' - assigns[:cache_tag].should_not == en_tag - end - it "should list internal_review requests as unresolved ones" do get :list, :view => 'awaiting' @@ -134,7 +121,7 @@ end describe RequestController, "when changing things that appear on the request page" do - integrate_views + render_views it "should purge the downstream cache when mail is received" do ir = info_requests(:fancy_dog_request) @@ -200,7 +187,7 @@ describe RequestController, "when changing things that appear on the request pag end describe RequestController, "when showing one request" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -458,7 +445,7 @@ describe RequestController, "when showing one request" do describe 'when handling incoming mail' do - integrate_views + render_views it "should receive incoming messages, send email to creator, and show them" do ir = info_requests(:fancy_dog_request) @@ -757,7 +744,7 @@ describe RequestController, "when showing one request" do assigns[:url_path].should_not == old_path response.location.should have_text(/#{assigns[:url_path]}/) zipfile = Zip::ZipFile.open(File.join(File.dirname(__FILE__), "../../cache/zips", assigns[:url_path])) { |zipfile| - zipfile.count.should == 5 # the message, two hello.txt, the unknown attachment, and its empty message + zipfile.count.should == 4 # the message, two hello.txt plus the unknown attachment } end @@ -908,7 +895,7 @@ describe RequestController, "when searching for an authority" do end describe RequestController, "when creating a new request" do - integrate_views + render_views before do @user = users(:bob_smith_user) @@ -1144,7 +1131,7 @@ describe RequestController, "when making a new request" do end describe RequestController, "when viewing an individual response for reply/followup" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -1577,7 +1564,7 @@ describe RequestController, "when classifying an information request" do end describe RequestController, "when sending a followup message" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -1659,7 +1646,7 @@ end # it can't check the URLs in the emails I don't think, ugh. describe RequestController, "sending overdue request alerts" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -1804,7 +1791,7 @@ describe RequestController, "sending overdue request alerts" do end describe RequestController, "sending unclassified new response reminder alerts" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -1834,7 +1821,7 @@ describe RequestController, "sending unclassified new response reminder alerts" end describe RequestController, "clarification required alerts" do - integrate_views + render_views before(:each) do load_raw_emails_data end @@ -1887,7 +1874,7 @@ describe RequestController, "clarification required alerts" do end describe RequestController, "comment alerts" do - integrate_views + render_views before(:each) do load_raw_emails_data end @@ -1966,7 +1953,7 @@ describe RequestController, "comment alerts" do end describe RequestController, "when viewing comments" do - integrate_views + render_views before(:each) do load_raw_emails_data end @@ -1989,7 +1976,7 @@ end describe RequestController, "authority uploads a response from the web interface" do - integrate_views + render_views before(:each) do # domain after the @ is used for authentication of FOI officers, so to test it @@ -2099,7 +2086,7 @@ end describe RequestController, "when doing type ahead searches" do - integrate_views + render_views it "should return nothing for the empty query string" do get :search_typeahead, :q => "" @@ -2157,7 +2144,7 @@ describe RequestController, "when doing type ahead searches" do end describe RequestController, "when showing similar requests" do - integrate_views + render_views it "should work" do get :similar, :url_title => info_requests(:badger_request).url_title @@ -2191,7 +2178,7 @@ describe RequestController, "when reporting a request when not logged in" do end describe RequestController, "when reporting a request (logged in)" do - integrate_views + render_views before do @user = users(:robin_user) diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index a701ae247..d2d22826a 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe ServicesController, "when using web services" do - integrate_views + render_views # store and restore the locale in the context of the test suite to isolate # changes made in these tests @@ -40,4 +40,4 @@ describe ServicesController, "when using web services" do FastGettext.set_locale(@old_locale) end -end
\ No newline at end of file +end diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index c785960b5..cd7932e90 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -56,7 +56,7 @@ describe TrackController, "when making a new track on a request" do end describe TrackController, "when sending alerts for a track" do - integrate_views + render_views include LinkToHelper # for main_url before(:each) do @@ -134,7 +134,7 @@ describe TrackController, "when sending alerts for a track" do end describe TrackController, "when viewing RSS feed for a track" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -164,7 +164,7 @@ end describe TrackController, "when viewing JSON version of a track feed" do - integrate_views + render_views before(:each) do load_raw_emails_data @@ -206,7 +206,7 @@ end describe TrackController, "when tracking a public body" do - integrate_views + render_views before(:each) do load_raw_emails_data diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index 23006803b..db64bdcaf 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -5,7 +5,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') # http://rspec.rubyforge.org/rspec-rails/1.1.12/classes/Spec/Rails/Example/ControllerExampleGroup.html describe UserController, "when showing a user" do - integrate_views + render_views before(:each) do load_raw_emails_data get_fixtures_xapian_index @@ -64,7 +64,7 @@ describe UserController, "when showing a user" do end describe UserController, "when signing in" do - integrate_views + render_views def get_last_postredirect post_redirects = PostRedirect.find_by_sql("select * from post_redirects order by id desc limit 1") @@ -228,7 +228,7 @@ describe UserController, "when signing in" do end describe UserController, "when signing up" do - integrate_views + render_views it "should be an error if you type the password differently each time" do post :signup, { :user_signup => { :email => 'new@localhost', :name => 'New Person', @@ -285,7 +285,7 @@ describe UserController, "when signing up" do end describe UserController, "when signing out" do - integrate_views + render_views it "should log you out and redirect to the home page" do session[:user_id] = users(:bob_smith_user).id @@ -309,7 +309,7 @@ describe UserController, "when signing out" do end describe UserController, "when sending another user a message" do - integrate_views + render_views it "should redirect to signin page if you go to the contact form and aren't signed in" do get :contact, :id => users(:silly_name_user) @@ -346,7 +346,7 @@ describe UserController, "when sending another user a message" do end describe UserController, "when changing password" do - integrate_views + render_views it "should show the email form when not logged in" do get :signchangepassword @@ -416,7 +416,7 @@ describe UserController, "when changing password" do end describe UserController, "when changing email address" do - integrate_views + render_views it "should require login" do get :signchangeemail @@ -561,7 +561,7 @@ describe UserController, "when changing email address" do end describe UserController, "when using profile photos" do - integrate_views + render_views before do @user = users(:bob_smith_user) @@ -631,7 +631,7 @@ describe UserController, "when showing JSON version for API" do end describe UserController, "when viewing the wall" do - integrate_views + render_views before(:each) do get_fixtures_xapian_index |