Skip to content

Commit

Permalink
fix: use Fatorybot method
Browse files Browse the repository at this point in the history
  • Loading branch information
syl-p committed Feb 21, 2024
1 parent 7fa4fe0 commit bafa7d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
class UsersControllerTest < ActionDispatch::IntegrationTest
include AuthorizationHelper
setup do
@auth = create(:access_token)
@admin = create(:user_admin, identifier: "admin")
@auth = FactoryBot.create(:access_token)
@admin = FactoryBot.create(:user_admin, identifier: "admin")
@auth_tokens = auth_tokens_for_user(@admin, @auth)
end

Expand All @@ -20,7 +20,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

test "test update route" do
if ENV['ENABLE_AUTHENTICATION'].present?
user_to_update = create(:user, identifier: "functional")
user_to_update = FactoryBot.create(:user, identifier: "functional")
patch user_url(user_to_update), params: {
user: {
firstname: "updated",
Expand All @@ -37,7 +37,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

test "test delete route" do
if ENV['ENABLE_AUTHENTICATION'].present?
user_to_delete = create(:user, identifier: "functional")
user_to_delete = FactoryBot.create(:user, identifier: "functional")
delete user_url(user_to_delete), headers: {
"Authorization": "Bearer #{@auth_tokens['access_token']}"
}
Expand All @@ -48,7 +48,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest

test "test process to unlock user and set password" do
# create a user locked by default
new_user = create(:user)
new_user = FactoryBot.create(:user)
new_user.lock_access!

# check by uuid
Expand Down

0 comments on commit bafa7d6

Please sign in to comment.