Sha256: dc9cf34849b424eede74afd798e11c6e76427c5ed64f688dda05b15eeeea1c48

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

require 'spec_helper'

describe Outpost::Model::Authentication do
  describe "::authenticate" do 
    it "returns the user if the username and password are correct" do
      user = create :user, password: "secret"
      User.authenticate(user.email, "secret").should eq user
    end
    
    it "returns false if the password is incorrect" do
      user = create :user, password: "secret"
      User.authenticate(user.email, "wrong").should eq false
    end
    
    it "returns false if the username isn't found" do
      user = create :user, email: "bricker@kpcc.org"
      User.authenticate("wrong", "secret").should eq false
    end
  end

  #----------------
  
  describe "downcase_email" do
    it "downcases the e-mail before validating and saving a user" do
      user = create :user, email: "SomeEmail@email.com"
      user.email.should eq "someemail@email.com"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
outpost-cms-0.0.3 spec/lib/model/authentication_spec.rb