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

Version Path
blacklight-spotlight-0.32.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.31.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.30.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.29.1 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.29.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.28.3 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.28.2 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.28.1 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.28.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.27.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.26.1 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.26.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.25.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.24.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.23.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.22.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.21.0 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.20.3 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.20.2 spec/helpers/spotlight/main_app_helpers_spec.rb
blacklight-spotlight-0.20.1 spec/helpers/spotlight/main_app_helpers_spec.rb