Sha256: 2f33a977c4c3ba55830eb9f6525f9d02e9f769475da5f3e0cd6406a5a11222dd

Contents?: true

Size: 885 Bytes

Versions: 16

Compression:

Stored size: 885 Bytes

Contents

require "test_helper"

module PushType
  describe ProfilesController do
    
    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, 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_redirect_to edit_profile_path }
      end
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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