Sha256: e967497c991e547ad64d92770761f53c8df6ce09becec6920a3aff62fa733c33
Contents?: true
Size: 1.08 KB
Versions: 33
Compression:
Stored size: 1.08 KB
Contents
require 'test_helper' module Adminpanel class UserTest < ActiveSupport::TestCase setup :assign_user def test_is_valid_user assert @test_user.save end def test_name_validation @test_user.name = "" assert_not @test_user.valid? end def test_email_validation @test_user.email = "foo@" assert_not @test_user.valid? @test_user.email = "foo@bar" assert_not @test_user.valid? @test_user.email = "@bar.baz" assert_not @test_user.valid? @test_user.email = "foo.baz" assert_not @test_user.valid? end def test_password_validation @test_user.password_confirmation = "foobaz" assert_not @test_user.valid? @test_user.password_confirmation = "foo" @test_user.password = "foo" assert_not @test_user.valid? end protected def assign_user @test_user = Adminpanel::User.new( name: "Example User", email: "foo@bar.com", password: "foobar", password_confirmation: "foobar", role_id: adminpanel_roles(:Admin).id ) end end end
Version data entries
33 entries across 33 versions & 1 rubygems