Sha256: 389e8058aeb65007f9d359b8bb34cec3ef803f8324126ec5b17b9f990aebfcdc

Contents?: true

Size: 924 Bytes

Versions: 11

Compression:

Stored size: 924 Bytes

Contents

require 'test_helper'

module PushType
  class Admin::ProfilesControllerTest < ActionController::TestCase
    
    let(:current_user) { FactoryGirl.create(:confirmed_user) }
    before { sign_in current_user }

    describe 'GET #edit' do
      before { get :edit }
      it { response.must_render_template 'edit' }
      it { assigns[:user].must_equal current_user }
    end

    describe 'PUT #update' do
      before { put :update, params: { user: { name: new_name } } }

      describe 'with invalid user' do
        let(:new_name) { '' }
        it { assigns[:user].errors.wont_be_empty }
        it { response.must_render_template :edit }
      end

      describe 'with valid user' do
        let(:new_name) { 'Test user ABC' }
        it { current_user.reload.name.must_equal new_name }
        it { flash[:notice].must_be :present? }
        it { response.must_respond_with :redirect }
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
push_type_auth-0.11.2 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.11.1 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.11.0.beta.2 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.11.0.beta.1 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.4 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.3 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.2 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.1 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.0 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.0.beta.5 test/controllers/push_type/admin/profiles_controller_test.rb
push_type_auth-0.10.0.beta.3 test/controllers/push_type/admin/profiles_controller_test.rb