Sha256: bba7364700082cb43bf496bb6c071f5385ecc39c54256f9b3f0c18bf376c04b8

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

require 'spec_helper'
require 'authenticate/model/db_password'


describe Authenticate::Model::DbPassword do

  it 'validates password' do
    user = build(:user, :without_password)
    user.save
    expect(user.errors.count).to be(1)
    expect(user.errors.messages[:password]).to eq(["can't be blank"])
  end

  it 'matches a password' do
    user = create(:user)
    expect(user.password_match? 'password').to be_truthy
  end

  it 'fails to match a bad password' do
    user = create(:user)
    expect(user.password_match? 'bad password').to be_falsey
  end

  it 'sets a password' do
    user = create(:user)
    user.password = 'new_password'
    user.save!

    user = User.find(user.id)
    expect(user.password_match? 'new_password').to be_truthy
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authenticate-0.2.1 spec/model/db_password_spec.rb