Sha256: 8e47dd929f92b4b68de8bc5c2cad7e9201eee8eb2a826aa7354b790eb36e6374
Contents?: true
Size: 1.62 KB
Versions: 24
Compression:
Stored size: 1.62 KB
Contents
describe Spotlight::MainAppHelpers, type: :helper do describe '#show_contact_form?' do subject { helper } let(:exhibit) { FactoryGirl.create :exhibit } let(:exhibit_with_contacts) { FactoryGirl.create :exhibit } context 'with an exhibit with confirmed contacts' do before do exhibit_with_contacts.contact_emails.create(email: 'cabeer@stanford.edu').tap do |e| if e.respond_to? :confirm e.confirm else e.confirm! end end end before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts } its(:show_contact_form?) { should be_truthy } end context 'with an exhibit with only unconfirmed contacts' do before { exhibit_with_contacts.contact_emails.build email: 'cabeer@stanford.edu' } before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts } its(:show_contact_form?) { should be_falsey } end context 'with an exhibit without contacts' do before { allow(helper).to receive_messages current_exhibit: exhibit } its(:show_contact_form?) { should be_falsey } end context 'outside the context of an exhibit' do before { allow(helper).to receive_messages current_exhibit: nil } its(:show_contact_form?) { should be_falsey } end context 'with a default contact address' do before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' } before { allow(helper).to receive_messages current_exhibit: exhibit } its(:show_contact_form?) { should be_truthy } end end end
Version data entries
24 entries across 24 versions & 1 rubygems