mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-01 03:55:44 +00:00
Upgraded to rails 8.0.2, moved from dalli to solid cache, moved from delayed_job to solid queue, and add solid cable. deploy/rails-dev-run.sh no longer needs to chmod. Fixed finished_at callback for matches. Migrated from Devise to built in rails auth. Added view tests for the bracket page testing that all bout numbers render for all matches in each bracket type.
This commit is contained in:
41
test/integration/users_login_test.rb
Normal file
41
test/integration/users_login_test.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
require "test_helper"
|
||||
|
||||
class UsersLoginTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@user = users(:one)
|
||||
# Ensure password is set for the fixture user
|
||||
@user.password_digest = BCrypt::Password.create('password')
|
||||
@user.save
|
||||
end
|
||||
|
||||
test "login with invalid information" do
|
||||
get login_path
|
||||
assert_template 'sessions/new'
|
||||
post login_path, params: { session: { email: "", password: "" } }
|
||||
assert_template 'sessions/new'
|
||||
assert_not flash.empty?
|
||||
get root_path
|
||||
assert flash.empty?
|
||||
end
|
||||
|
||||
test "login with valid information followed by logout" do
|
||||
get login_path
|
||||
post login_path, params: { session: { email: @user.email,
|
||||
password: 'password' } }
|
||||
assert session[:user_id].present?
|
||||
assert_redirected_to root_path
|
||||
follow_redirect!
|
||||
assert_template 'static_pages/home'
|
||||
|
||||
# Verify logout
|
||||
delete logout_path
|
||||
assert_nil session[:user_id]
|
||||
assert_redirected_to root_path
|
||||
follow_redirect!
|
||||
assert_template 'static_pages/home'
|
||||
end
|
||||
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
27
test/integration/users_signup_test.rb
Normal file
27
test/integration/users_signup_test.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require "test_helper"
|
||||
|
||||
class UsersSignupTest < ActionDispatch::IntegrationTest
|
||||
test "invalid signup information" do
|
||||
get signup_path
|
||||
assert_no_difference 'User.count' do
|
||||
post signup_path, params: { user: { email: "user@invalid",
|
||||
password: "foo",
|
||||
password_confirmation: "bar" } }
|
||||
end
|
||||
assert_template 'users/new'
|
||||
assert_select 'div.error_explanation'
|
||||
assert_select 'div.alert-danger'
|
||||
end
|
||||
|
||||
test "valid signup information" do
|
||||
get signup_path
|
||||
assert_difference 'User.count', 1 do
|
||||
post signup_path, params: { user: { email: "user@example.com",
|
||||
password: "password",
|
||||
password_confirmation: "password" } }
|
||||
end
|
||||
follow_redirect!
|
||||
assert_template 'static_pages/home'
|
||||
assert session[:user_id].present?
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user