Sha256: 01450b3b47d052865617134eb92e6e8fa05af4da733ba40bbc37e7ccd8af1f7e

Contents?: true

Size: 1.33 KB

Versions: 30

Compression:

Stored size: 1.33 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::Right::Password do

  before :each do
    @user_card = Card::Auth[ 'joe@user.com' ]
  end
  
  describe '#update_attributes' do

    it 'should encrypt password' do
      @user_card.account.password_card.update_attributes! :content => 'new password'
      expect(@user_card.account.password).not_to eq('new password')
      assert_equal @user_card.id, Card::Auth.authenticate('joe@user.com', 'new password')
    end

    it 'should validate password' do
      password_card = @user_card.account.password_card
      password_card.update_attributes :content => '2b'
      expect(password_card.errors[:password]).not_to be_empty
      
    end
    
    context 'blank password' do
      it "shouldn't change the password" do
        acct = @user_card.account
        original_pw = acct.password
        expect(original_pw.size).to be > 10
        pw_card = acct.password_card
        pw_card.content = ''
        pw_card.save
        expect(original_pw).to eq(pw_card.refresh(force=true).content)
      end
      
      it "shouldn't break email editing" do
        @user_card.account.update_attributes! :subcards=>{'+*password'=>'', '+*email'=>'joe2@user.com'}
        expect(@user_card.account.email).to eq('joe2@user.com')
        expect(@user_card.account.password).not_to be_empty
      end
    end
  end
  
  

end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
card-1.16.6 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.5 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.4 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.3 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.2 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.1 mod/05_standard/spec/set/right/password_spec.rb
card-1.16.0 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.7 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.6 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.5 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.4 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.3 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.2 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.1 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.0 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.pre2 mod/05_standard/spec/set/right/password_spec.rb
card-1.15.pre mod/05_standard/spec/set/right/password_spec.rb
wagn-1.14.9 mod/05_standard/spec/set/right/password_spec.rb
wagn-1.14.8 mod/05_standard/spec/set/right/password_spec.rb
wagn-1.14.7 mod/05_standard/spec/set/right/password_spec.rb