Sha256: c92719f2b1577badc3e03f23e160aa5d3dede718b839ebd79a4f7d84593ef246

Contents?: true

Size: 1.08 KB

Versions: 23

Compression:

Stored size: 1.08 KB

Contents

describe Spotlight::ConfirmationsController, type: :controller do
  routes { Spotlight::Engine.routes }
  before do
    # rubocop:disable RSpec/InstanceVariable
    @request.env['devise.mapping'] = Devise.mappings[:contact_email]
    # rubocop:enable RSpec/InstanceVariable
  end

  describe 'GET new' do
    it 'exists' do
      get :new
      expect(response).to be_successful
    end
  end

  describe 'GET show' do
    let(:exhibit) { FactoryGirl.create(:exhibit) }
    let(:contact_email) { Spotlight::ContactEmail.create!(email: 'justin@example.com', exhibit: exhibit) }
    let(:raw_token) { contact_email.instance_variable_get(:@raw_confirmation_token) }
    describe 'when the token is invalid' do
      it 'gives reset instructions' do
        get :show
        expect(response).to be_successful
      end
    end
    describe 'when the token is valid' do
      it 'updates the user' do
        get :show, params: { confirmation_token: raw_token }
        expect(contact_email.reload).to be_confirmed
        expect(response).to redirect_to main_app.new_user_session_path
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-1.0.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.34.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.34.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.33.3 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.33.2 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.33.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.33.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.32.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.31.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.30.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.29.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.29.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.28.3 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.28.2 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.28.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.28.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.27.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.26.1 spec/controllers/spotlight/confirmations_controller_spec.rb