Sha256: 58ee9f9d9e257e308a2682873579359fbbfd447a3499b192e1efa77b4dc7d51c

Contents?: true

Size: 962 Bytes

Versions: 9

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'

describe Spotlight::ContactFormsController, type: :controller do
  routes { Spotlight::Engine.routes }
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  before do
    request.env['HTTP_REFERER'] = 'http://example.com'
    exhibit.contact_emails_attributes = [{ 'email' => 'test@example.com' }, { 'email' => 'test2@example.com' }]
    exhibit.save!
    exhibit.contact_emails.first.tap do |e|
      if e.respond_to? :confirm
        e.confirm
      else
        e.confirm!
      end
    end
  end
  describe 'POST create' do
    it 'redirects back' do
      post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
      expect(response).to redirect_to :back
    end
    it 'sets a flash message' do
      post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
      expect(flash[:notice]).to eq 'Thanks. Your feedback has been sent.'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-0.18.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.17.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.17.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.16.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.15.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.14.2 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.14.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.14.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.13.0 spec/controllers/spotlight/contact_forms_controller_spec.rb