Sha256: f94f76fccd885d225ae9dab1478e44909a8c897d1edcaad392b9fdf65f5baac3

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

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 { exhibit_with_contacts.contact_emails.create(email: 'cabeer@stanford.edu').confirm! }
      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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.2.0 spec/helpers/spotlight/main_app_helpers_spec.rb