Emails are case insensitive

This commit is contained in:
Neil Lalonde
2014-07-14 10:16:24 -04:00
parent 0c8025d513
commit 01a68f8cc7
18 changed files with 105 additions and 13 deletions

View File

@@ -15,6 +15,11 @@ describe ScreenedEmail do
# have ever been blocked by looking at last_match_at.
ScreenedEmail.create(email: email).last_match_at.should be_nil
end
it "downcases the email" do
s = ScreenedEmail.create(email: 'SPAMZ@EXAMPLE.COM')
s.email.should == 'spamz@example.com'
end
end
describe '#block' do
@@ -66,6 +71,11 @@ describe ScreenedEmail do
ScreenedEmail.should_block?(email).should be_true
end
it "returns true when it's same email, but all caps" do
ScreenedEmail.create(email: email).save
ScreenedEmail.should_block?(email.upcase).should be_true
end
shared_examples "when a ScreenedEmail record matches" do
it "updates statistics" do
Timecop.freeze(Time.zone.now) do