Finish user tests
This commit is contained in:
parent
95987e48fe
commit
d72f691442
2 changed files with 30 additions and 5 deletions
6
test/fixtures/users.yml
vendored
6
test/fixtures/users.yml
vendored
|
@ -28,8 +28,10 @@
|
|||
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
user:
|
||||
nickname: 'Gebruiker'
|
||||
benji:
|
||||
nickname: 'benji'
|
||||
name: 'Benjamin'
|
||||
last_name: 'Cousaert'
|
||||
|
||||
admin:
|
||||
nickname: 'admin'
|
||||
|
|
|
@ -29,7 +29,30 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
def setup
|
||||
@user = users(:benji)
|
||||
end
|
||||
|
||||
test "full name" do
|
||||
assert_equal @user.full_name, "Benjamin Cousaert"
|
||||
end
|
||||
|
||||
test "balance behaves correctly" do
|
||||
assert_equal @user.balance_cents, 0
|
||||
assert_equal @user.balance, 0
|
||||
|
||||
@user.balance = 1.3
|
||||
|
||||
assert_equal @user.balance, 1.3
|
||||
assert_equal @user.balance_cents, 130
|
||||
end
|
||||
|
||||
test "to_param" do
|
||||
assert_equal @user.to_param, "#{@user.id}-benji"
|
||||
end
|
||||
|
||||
test "devise validatable methods" do
|
||||
assert_not @user.email_required?
|
||||
assert_not @user.email_changed?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue