From 91edbbf49d717d2b559153a0bf151879f12087bc Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Wed, 7 Sep 2011 23:41:26 +0100 Subject: =?UTF-8?q?Fix=20=E2=80=9Cemail=20bounced=E2=80=9D=20recording?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add tests for the User.record_bounce_for_email method and (not coincidentally) make it actually work. --- spec/models/user_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/models/user_spec.rb') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ee6916ffc..fc56d3365 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -282,3 +282,14 @@ describe User, "when setting a profile photo" do # end end +describe User, "when emails have bounced" do + fixtures :users + + it "should record bounces" do + User.record_bounce_for_email("bob@localhost", "The reason we think the email bounced (e.g. a bounce message)") + + user = User.find_user_by_email("bob@localhost") + user.email_bounced_at.should_not be_nil + user.email_bounce_message.should == "The reason we think the email bounced (e.g. a bounce message)" + end +end -- cgit v1.2.3 From 55ab78f81b66edbf34c806df48677a1156c499d8 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Thu, 8 Sep 2011 00:39:13 +0100 Subject: Fix User.should_be_emailed? The User.should_be_emailed? method needs to be public. It should also be tested. --- spec/models/user_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/models/user_spec.rb') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index fc56d3365..751a61060 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -282,6 +282,18 @@ describe User, "when setting a profile photo" do # end end +describe User, "when unconfirmed" do + fixtures :users + + before do + @user = users(:unconfirmed_user) + end + + it "should not be emailed" do + @user.should_be_emailed?.should be_false + end +end + describe User, "when emails have bounced" do fixtures :users -- cgit v1.2.3