diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/general_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/controllers/track_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/user_controller_spec.rb | 5 |
4 files changed, 15 insertions, 14 deletions
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index a8f8bc901..40a676d61 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -74,13 +74,13 @@ describe GeneralController, "when searching" do 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 - ActionController::Routing::Routes.add_filters(['conditionallyprependlocale']) + ActionController::Routing::Routes.add_filters('conditionallyprependlocale') get :frontpage response.should have_text(home_link_regex) end it "should generate URLs without a locale prepended when there's only one locale set" do - ActionController::Routing::Routes.add_filters(['conditionallyprependlocale']) + ActionController::Routing::Routes.add_filters('conditionallyprependlocale') old_available_locales = FastGettext.default_available_locales available_locales = ['en'] FastGettext.default_available_locales = available_locales diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 32e14cd52..3420d212e 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -807,7 +807,7 @@ describe RequestController, "when classifying an information request" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /as needing admin/ - mail.from_addrs.to_s.should == @request_owner.name_and_email + mail.from_addrs.first.to_s.should == @request_owner.name_and_email end it 'should say it is showing advice as to what to do next' do @@ -985,7 +985,7 @@ describe RequestController, "when sending a followup message" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /What a useless response! You suck./ - mail.to_addrs.to_s.should == "FOI Person <foiperson@localhost>" + mail.to_addrs.first.to_s.should == "FOI Person <foiperson@localhost>" response.should redirect_to(:action => 'show', :url_title => info_requests(:fancy_dog_request).url_title) @@ -1032,7 +1032,7 @@ describe RequestController, "sending overdue request alerts" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /promptly, as normally/ - mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 @@ -1060,7 +1060,7 @@ describe RequestController, "sending overdue request alerts" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /promptly, as normally/ - mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email end it "should send not actually send the overdue alert if the user is banned" do @@ -1085,7 +1085,7 @@ describe RequestController, "sending overdue request alerts" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /required by law/ - mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 @@ -1116,7 +1116,7 @@ describe RequestController, "sending unclassified new response reminder alerts" deliveries.size.should == 3 # sufficiently late it sends reminders too mail = deliveries[0] mail.body.should =~ /To let us know/ - mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 mail_token = $2 @@ -1153,7 +1153,7 @@ describe RequestController, "clarification required alerts" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /asked you to explain/ - mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 mail_token = $2 @@ -1207,7 +1207,7 @@ describe RequestController, "comment alerts" do deliveries = ActionMailer::Base.deliveries mail = deliveries[0] mail.body.should =~ /has annotated your/ - mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email mail.body =~ /(http:\/\/.*)/ mail_url = $1 @@ -1250,7 +1250,7 @@ describe RequestController, "comment alerts" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /There are 2 new annotations/ - mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email + mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email mail.body =~ /(http:\/\/.*)/ mail_url = $1 diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 7fcc81017..90d13495f 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -58,7 +58,7 @@ describe TrackController, "when sending alerts for a track" do deliveries.size.should == 1 mail = deliveries[0] mail.body.should =~ /Alter your subscription/ - mail.to_addrs.to_s.should include(users(:silly_name_user).email) + mail.to_addrs.first.to_s.should include(users(:silly_name_user).email) mail.body =~ /(http:\/\/.*\/c\/(.*))/ mail_url = $1 mail_token = $2 diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index fdc3961a1..399b275a7 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'json' @@ -260,8 +261,8 @@ describe UserController, "when sending another user a message" do mail = deliveries[0] mail.body.should include("Bob Smith has used #{MySociety::Config.get('SITE_NAME')} to send you the message below") mail.body.should include("Just a test!") - #mail.to_addrs.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email - mail.from_addrs.to_s.should == users(:bob_smith_user).name_and_email + #mail.to_addrs.first.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email + mail.from_addrs.first.to_s.should == users(:bob_smith_user).name_and_email end end |