Sha256: 2077db882750d157f65370aa0cd807a093617d3a09adf7e15dfc4f790fa42092

Contents?: true

Size: 1.12 KB

Versions: 22

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

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) { FactoryBot.create(:exhibit) }
    let(:contact_email) { FactoryBot.create(:contact_email, 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

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.3.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.2.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.1.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.3 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.2 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/controllers/spotlight/confirmations_controller_spec.rb