Create fake model for session

This commit is contained in:
Andrew Tomaka 2024-08-01 21:33:02 -04:00
parent a70c656690
commit a3a09e845f
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
3 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,25 @@
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")
refute session.save
end
def test_save_when_password_incorrect
user = users(:one)
session = Session.new(email: user.email, password: "bad_password")
refute session.save
end
end