Soc/test/models/user_test.rb

39 lines
942 B
Ruby
Raw Normal View History

2023-08-19 14:38:38 +00:00
# frozen_string_literal: true
2023-08-08 19:25:35 +00:00
require "test_helper"
class UserTest < ActiveSupport::TestCase
2023-08-19 14:38:38 +00:00
include ActionMailer::TestHelper
2023-08-08 19:25:35 +00:00
test "email must resemble an email" do
user = users(:user)
user.email = "foobar"
assert_not user.valid?
end
2023-08-19 14:38:38 +00:00
test "a new user requires confirmation" do
user = User.create(
username: "gorkamorka",
email: "gorka@morka.com",
first_name: "Ork",
last_names: "Boyz",
password: "snotlings-are-for-squashing",
password_confirmation: "snotlings-are-for-squashing",
)
assert user.requires_confirmation?
end
test "a new user requests confirmation" do
assert_emails 1 do
User.create(
username: "gorkamorka",
email: "gorka@morka.com",
first_name: "Ork",
last_names: "Boyz",
password: "snotlings-are-for-squashing",
password_confirmation: "snotlings-are-for-squashing",
)
end
end
2023-08-08 19:25:35 +00:00
end