26 lines
531 B
Ruby
26 lines
531 B
Ruby
|
require "test_helper"
|
||
|
|
||
|
class SessionTest < ActiveSupport::TestCase
|
||
|
def test_save_when_exists
|
||
|
user = users(:one)
|
||
|
|
||
|
session = Session.new(email: user.email, password: "secret")
|
||
|
|
||
|
assert session.save
|
||
|
end
|
||
|
|
||
|
def test_save_when_not_exists
|
||
|
session = Session.new(email: "fake@example.org", password: "secret")
|
||
|
|
||
|
assert_not session.save
|
||
|
end
|
||
|
|
||
|
def test_save_when_password_incorrect
|
||
|
user = users(:one)
|
||
|
|
||
|
session = Session.new(email: user.email, password: "bad_password")
|
||
|
|
||
|
assert_not session.save
|
||
|
end
|
||
|
end
|