Sha256: 9f434c0c9f066eca0fbc215c22893ca607617d0751a2f9d698d21034594b227f

Contents?: true

Size: 958 Bytes

Versions: 18

Compression:

Stored size: 958 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 '#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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-0.12.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.12.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.11.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.10.3 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.10.2 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.10.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.10.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.9.2 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.9.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.9.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.8.2 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.8.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.8.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.7.2 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.7.1 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.7.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.6.0 spec/controllers/spotlight/contact_forms_controller_spec.rb
blacklight-spotlight-0.5.0 spec/controllers/spotlight/contact_forms_controller_spec.rb