foodsoft/test/unit/user_test.rb
benni 8a74e7d77f Removed annoate and hirb Gemfiles.
Annotate: Better look in schema.rb, this reference should be always up
to date.

Hirb: To reactivate hirb, look in railscasts:
http://railscasts.com/episodes/48-console-tricks-revised
2012-07-27 18:07:42 +02:00

34 lines
930 B
Ruby

require File.dirname(__FILE__) + '/../test_helper'
class UserTest < Test::Unit::TestCase
fixtures :users
def setup
@admin = users(:admin)
end
def test_read_user
assert_kind_of User, @admin
assert_equal "Anton", @admin.first_name
assert_equal "Admininistrator", @admin.last_name
assert_equal "admin@foo.test", @admin.email
assert @admin.role_admin?
end
def test_create_and_read_password
@admin.set_password({:required => true}, "secret", "secret")
@admin.save
assert @admin.has_password("secret")
end
def test_invalid_password
@admin.set_password({:required => true}, "foo", "foo")
assert_equal 'Passwort muss zwischen 6 u. 25 Zeichen haben', @admin.errors.on_base
end
def test_password_not_match
@admin.set_password({:required => true}, "foobar", "foobor")
assert_equal 'Passworteingaben stimmen nicht überein', @admin.errors.on_base
end
end