Sha256: 6d2b9974f1e10fc465d03878b0104db787e2efe6c22522215f0aa394c754fc69
Contents?: true
Size: 1.27 KB
Versions: 15
Compression:
Stored size: 1.27 KB
Contents
require 'test_helper' module PushType class ConfirmationsControllerTest < ActionController::TestCase before { @request.env["devise.mapping"] = Devise.mappings[:user] } let(:user) { FactoryGirl.create(:user) } let(:token) { user.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
15 entries across 15 versions & 1 rubygems