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