parent
96ca8b7e7c
commit
452be0c49c
10 changed files with 59 additions and 10 deletions
|
@ -4,4 +4,15 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|||
driven_by :selenium,
|
||||
using: ENV["VISIBLE_SYSTEM_TESTS"].present? ? :chrome : :headless_chrome,
|
||||
screen_size: [ 1400, 1400 ]
|
||||
|
||||
def login(email, password = "secret")
|
||||
visit new_session_url
|
||||
|
||||
fill_in "Email", with: email
|
||||
fill_in "Password", with: "secret"
|
||||
|
||||
click_on "Create Session"
|
||||
|
||||
assert_text "Session was successfully created"
|
||||
end
|
||||
end
|
||||
|
|
11
test/models/guest_user_test.rb
Normal file
11
test/models/guest_user_test.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require "test_helper"
|
||||
|
||||
class GuestUserTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@user = GuestUser.new
|
||||
end
|
||||
|
||||
def test_registered_false
|
||||
assert_not @user.registered?
|
||||
end
|
||||
end
|
|
@ -1,7 +1,11 @@
|
|||
require "test_helper"
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
setup do
|
||||
@user = users(:one)
|
||||
end
|
||||
|
||||
def test_registered_true
|
||||
assert @user.registered?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,17 +6,14 @@ class SessionsTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
test "should create session" do
|
||||
visit new_session_url
|
||||
|
||||
fill_in "Email", with: @user.email
|
||||
fill_in "Password", with: "secret"
|
||||
|
||||
click_on "Create Session"
|
||||
login(@user.email)
|
||||
|
||||
assert_text "Session was successfully created"
|
||||
end
|
||||
|
||||
test "should destroy Session" do
|
||||
login(@user.email)
|
||||
|
||||
visit root_url
|
||||
click_on "Log out", match: :first
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue