Sha256: 212d83308f7498e0505ebb447cfd128ae3eab91eecdde2ec511cc73c28480dd1

Contents?: true

Size: 1015 Bytes

Versions: 4

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'

describe Spotlight::ConfirmationsController, :type => :controller do
  routes { Spotlight::Engine.routes }
  before {
     @request.env["devise.mapping"] = Devise.mappings[:contact_email]
  }
  it "should have 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 "should give reset instructions" do
        get :show
        expect(response).to be_successful
      end
    end
    describe "when the token is valid" do
      it "should update 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

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.3.1 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.3.0 spec/controllers/spotlight/confirmations_controller_spec.rb
blacklight-spotlight-0.2.0 spec/controllers/spotlight/confirmations_controller_spec.rb