I am currently having trouble testing for destroying users generated with devise.
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
def setup
@user = User.new(email: "user@example.com")
end
test "Should delete User"do
@user.save
assert_difference 'User.count', -1 do
@user.destroy
end
end
end
Currently the tests fail and show that the difference was 0. I was wondering how I could test this (even though I know user.destroy works when I run it in a rails console).
All the best D
Aucun commentaire:
Enregistrer un commentaire