I have two tests. The results of each depend upon the user count.
At the moment, I have no user fixtures. The second test introduces a user in its setup method. The first test would fail if there were users in the db.
But I want to introduce users in users.yml. As such, the second test will fail because of the existing users. Is there any way I can instruct this test to ignore fixtures/users.yml?
require 'test_helper'
class UsersSignupTestWithoutExistingUsers < ActionDispatch::IntegrationTest
test "Signup page is accessible" do
get new_user_registration_path
assert_response :success
end
end
class UsersSignupTestWithExistingUsers < ActionDispatch::IntegrationTest
def setup
post user_registration_path, params: {user: {
email: "user@test.com",
password: "password",
password_confirmation: "password"
}}
end
test "Signup page will redirect" do
get new_user_registration_path
assert_response :redirect
end
end
Aucun commentaire:
Enregistrer un commentaire