Sha256: 7cb8fcb23b04e00526b216da5a14f1939cef2f5aee50581d4da779a77b14bfb7

Contents?: true

Size: 1.05 KB

Versions: 18

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

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
  it 'has new' do
    get :new
    expect(response).to be_successful
  end

  describe '#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, 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

18 entries across 18 versions & 1 rubygems

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