Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xet7 committed Nov 2, 2024
1 parent 71f7494 commit 814314c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def sign_in_as(user)
click_on "Login to your account"

assert_current_path workspaces_path
session[:user_id] = user.id # Add this line to ensure session is set
user
end

def teardown
super
session[:user_id] = nil if respond_to?(:session)
end
end
10 changes: 9 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ class TestCase

# Add more helper methods to be used by all tests here...
def sign_in_as(user)
post(sign_in_url, params: { email: user.email, password: "Secret1*3*5*" })
if respond_to?(:post)
post(sign_in_url, params: { email: user.email, password: "Secret1*3*5*" })
else
session[:user_id] = user.id
end
user
end

def teardown
session[:user_id] = nil if respond_to?(:session)
end

# Pundit helpers
def assert_permit(user, record, action)
msg = "User #{user.inspect} should be permitted to #{action} #{record}, but isn't permitted"
Expand Down

0 comments on commit 814314c

Please sign in to comment.