Sha256: b418196172a8a7cb7cffbd8e72748f868f1ea5488ca839ad00a9b83386ffee42
Contents?: true
Size: 1.24 KB
Versions: 33
Compression:
Stored size: 1.24 KB
Contents
describe Spotlight::ContactEmail, type: :model do let(:exhibit) { FactoryGirl.create(:exhibit) } subject { described_class.new(exhibit: exhibit) } it { is_expected.not_to be_valid } describe 'with an invalid email set' do before { subject.email = '@-foo' } it 'does not be valid' do expect(subject).to_not be_valid expect(subject.errors[:email]).to eq ['is not valid'] end end describe 'with a valid email set' do before { subject.email = 'foo@example.com' } it { is_expected.to be_valid } describe '#send_devise_notification' do it 'sends stuff' do expect do subject.send(:send_devise_notification, :confirmation_instructions, 'Q7PEPdLVxymsQL2_s_Rg', {}) end.to change { ActionMailer::Base.deliveries.count }.by(1) end end end describe '.confirmed' do it 'scopes contacts to only confirmed contacts' do a = exhibit.contact_emails.create(email: 'a@example.com') if a.respond_to? :confirm a.confirm else a.confirm! end b = exhibit.contact_emails.create(email: 'b@example.com') expect(described_class.confirmed.to_a).to include a expect(described_class.confirmed.to_a).to_not include b end end end
Version data entries
33 entries across 33 versions & 1 rubygems