Sha256: 4d39e720095f7d6438523400629b76a69edaae3adbfb860385eae0d461bc88a9

Contents?: true

Size: 681 Bytes

Versions: 8

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'
require 'authenticate/model/email'

describe Authenticate::Model::Email do
  it 'validates email' do
    user = build(:user, :without_email)
    user.save
    expect(user.errors.count).to be(2)
    expect(user.errors.messages[:email]).to include('is invalid')
    expect(user.errors.messages[:email]).to include("can't be blank")
  end

  it 'extracts credentials from params' do
    params = { session: { email: 'foo', password: 'bar' } }
    expect(User.credentials(params)).to match_array(%w(foo bar))
  end

  it 'authenticates from credentials' do
    user = create(:user)
    expect(User.authenticate([user.email, user.password])).to eq(user)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authenticate-0.7.1 spec/model/email_spec.rb
authenticate-0.7.0 spec/model/email_spec.rb
authenticate-0.6.1 spec/model/email_spec.rb
authenticate-0.6.0 spec/model/email_spec.rb
authenticate-0.5.0 spec/model/email_spec.rb
authenticate-0.4.0 spec/model/email_spec.rb
authenticate-0.3.3 spec/model/email_spec.rb
authenticate-0.3.2 spec/model/email_spec.rb