当我添加这个测试并运行整个测试套件时,另一个测试失败了。每次都是不同的,但错误总是一样的。
我正在使用带有 Devise 和 Paranoia 的 Rails(这是我正在测试的,用于软删除)。
这是错误:
SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users" ("last_sign_in_at", "current_sign_in_at", "last_sign_in_ip", "current_sign_in_ip", "sign_in_count") VALUES (?, ?, ?, ?, ?)
这是使其他测试失败的测试。
require "rails_helper"
feature "User soft deletes project" do
scenario "successfully" do
user = create(:user)
login_as(user, scope: :user)
project = create(:project, creator: user)
visit edit_user_project_path(user, project)
expect {
click_on "Delete Project"
}.to change(Project, :count).by(-1)
expect(page).to have_content("Project was successfully destroyed")
expect(Project.unscoped.count).to eq(1)
end
end