diff options
author | Brett Walker <brett@digitalmoksha.com> | 2017-09-20 14:24:10 +0300 |
---|---|---|
committer | Brett Walker <brett@digitalmoksha.com> | 2017-09-23 16:26:04 +0300 |
commit | 665c7876faadc41e1c7a77bb423b951cbcb020ce (patch) | |
tree | 6250727aee6c97f50e4f254da3c1bc0717206fee /spec/models/email_spec.rb | |
parent | ed99c899a28134e8d9a1a8a8c4677a6ee65bbd2b (diff) |
added email.confirmed scope and fix email comparison
Diffstat (limited to 'spec/models/email_spec.rb')
-rw-r--r-- | spec/models/email_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb index 8ae5ccd89ed..8e8ef411f23 100644 --- a/spec/models/email_spec.rb +++ b/spec/models/email_spec.rb @@ -26,4 +26,15 @@ describe Email do email.confirm end end + + describe 'scopes' do + let(:user) { create(:user) } + + it 'scopes confirmed emails' do + create(:email, :confirmed, user: user) + expect(user.emails.count).to eq 1 + expect(user.emails.unconfirmed.count).to eq 0 + expect(user.emails.confirmed.count).to eq 1 + end + end end |