Sha256: 5ca748f7ff7ef5532564f668a4d5cd1e9cc097cfe373a7595f2de67a16f1f3e7

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

require "spec_helper"

describe "users" do
  describe "visit edit page before login" do
    let(:url) { user_path }
    it_should_behave_like "login required"
  end

  describe "edit" do
    let!(:user) { build(:user) }

    before do
      login_with user
    end

    after do
      # reset password to the default
      FileUtils.rm_f(User::ENCRYPTED_PASSWORD_FILE)
    end

    describe 'to change password' do
      let(:current_password) { user.password }
      let(:password) { 'new_password' }

      before do
        visit user_path
        fill_in 'user[current_password]', with: current_password

        fill_in 'user[password]', with: password
        fill_in 'user[password_confirmation]', with: password_confirmation
        click_button I18n.t("terms.update_password")
      end

      context 'when valid new password/confirmation is input' do
        let(:password_confirmation) { password }

        it 'should update users password with new password' do
          expect(page).to have_css('.alert-success')
          expect(user.stored_digest).to eq user.digest(password)
        end
      end

      context 'when invalid new password/confirmation is input' do
        let(:password_confirmation) { 'invalid_password' }

        it 'should not update users password with new password' do
          expect(page).to have_css('.alert-danger')
          expect(user.stored_digest).to eq user.digest(current_password)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fluentd-ui-1.0.0.beta.1 spec/features/users_spec.rb
fluentd-ui-1.0.0.alpha.3 spec/features/users_spec.rb
fluentd-ui-1.0.0.alpha.2 spec/features/users_spec.rb
fluentd-ui-1.0.0.alpha.1 spec/features/users_spec.rb
fluentd-ui-0.4.5 spec/features/users_spec.rb
fluentd-ui-0.4.4 spec/features/users_spec.rb
fluentd-ui-0.4.3 spec/features/users_spec.rb
fluentd-ui-0.4.2 spec/features/users_spec.rb
fluentd-ui-0.4.1 spec/features/users_spec.rb
fluentd-ui-0.4.0 spec/features/users_spec.rb
fluentd-ui-0.3.21 spec/features/users_spec.rb
fluentd-ui-0.3.20 spec/features/users_spec.rb