Sha256: a5b23b1271c98c5b97b38c9f41f8a622610588d81528c95c36f8a1cb4dccbdd3
Contents?: true
Size: 1.27 KB
Versions: 22
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true describe Spotlight::ContactEmail, type: :model do subject { described_class.new(exhibit: exhibit) } let(:exhibit) { FactoryBot.build_stubbed(: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).not_to 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).not_to include b end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
blacklight-spotlight-3.0.0.alpha.4 | spec/models/spotlight/contact_email_spec.rb |
blacklight-spotlight-3.0.0.alpha.3 | spec/models/spotlight/contact_email_spec.rb |