diff options
-rw-r--r-- | lib/sendmail_return_path.rb | 2 | ||||
-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 | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/lib/sendmail_return_path.rb b/lib/sendmail_return_path.rb index d8922f78b..23c4d4376 100644 --- a/lib/sendmail_return_path.rb +++ b/lib/sendmail_return_path.rb @@ -6,7 +6,7 @@ module ActionMailer class Base def perform_delivery_sendmail(mail) - sender = (mail['return-path'] && mail['return-path'].spec) || mail.from + sender = (mail['return-path'] && mail['return-path'].spec) || mail.from.first sendmail_args = sendmail_settings[:arguments].dup sendmail_args += " -f \"#{sender}\"" diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index fe994c916..f919d0d97 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -808,7 +808,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 @@ -986,7 +986,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) @@ -1033,7 +1033,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 @@ -1061,7 +1061,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 @@ -1086,7 +1086,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 @@ -1117,7 +1117,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 @@ -1154,7 +1154,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 @@ -1208,7 +1208,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 @@ -1251,7 +1251,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 617e36213..1fb5b2489 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 824cc9c42..9b7b99839 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -261,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 |