Sha256: f6a932bbfeae9ff0a0302ab802bc966629105ad4369145989bb32d33accf1314

Contents?: true

Size: 1.27 KB

Versions: 17

Compression:

Stored size: 1.27 KB

Contents

require "test_helper"

module PushType
  describe ConfirmationsController do

    before { @request.env["devise.mapping"] = Devise.mappings[:user] }

    let(:user)  { FactoryGirl.create(:user) }
    let(:token) { user.instance_variable_get :'@raw_confirmation_token' }
    
    describe 'GET #show' do
      before { get :show, confirmation_token: token }
      describe 'with invalid confirmation token' do
        let(:token) { 'invalid' }
        it { response.must_render_template 'new' }
        it { assigns[:user].must_be :new_record? }
      end
      describe 'with valid confirmation token' do
        it { response.must_render_template 'show' }
        it { assigns[:user].must_equal user }
      end
    end

    describe 'PUT #update' do
      before { put :update, user: { confirmation_token: token, password: password, password_confirmation: password } }
      describe 'with invalid user' do
        let(:password) { '' }
        it { assigns[:user].errors.wont_be_empty }
        it { assigns[:user].wont_be :confirmed? }
        it { response.must_render_template :show }
      end
      describe 'with valid user' do
        let(:password) { 'pa$$word' }
        it { user.reload.must_be :confirmed? }
        it { response.must_redirect_to root_path }
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
push_type_auth-0.5.1 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0.alpha.5 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0.alpha.4 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0.alpha.3 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0.alpha.2 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.5.0.alpha.1 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.4.0 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.4.0.beta.3 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.3.3 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.3.1 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.2.1 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.2.0 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.2.0.beta2 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.1.1 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.1.0 test/controllers/push_type/confirmations_controller_test.rb
push_type_auth-0.1.0.beta3 test/controllers/push_type/confirmations_controller_test.rb