2014-12-04 19:50:02 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: users
|
|
|
|
#
|
2014-12-09 18:56:56 +01:00
|
|
|
# id :integer not null, primary key
|
2015-03-19 16:22:55 +01:00
|
|
|
# debt_cents :integer default("0"), not null
|
2014-12-09 18:56:56 +01:00
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# remember_created_at :datetime
|
2015-03-19 16:22:55 +01:00
|
|
|
# sign_in_count :integer default("0"), not null
|
2014-12-09 18:56:56 +01:00
|
|
|
# current_sign_in_at :datetime
|
|
|
|
# last_sign_in_at :datetime
|
2015-03-19 16:22:55 +01:00
|
|
|
# current_sign_in_ip :string
|
|
|
|
# last_sign_in_ip :string
|
|
|
|
# admin :boolean
|
|
|
|
# dagschotel_id :integer
|
|
|
|
# avatar_file_name :string
|
|
|
|
# avatar_content_type :string
|
|
|
|
# avatar_file_size :integer
|
|
|
|
# avatar_updated_at :datetime
|
|
|
|
# orders_count :integer default("0")
|
|
|
|
# koelkast :boolean default("f")
|
|
|
|
# provider :string
|
|
|
|
# uid :string
|
2015-03-20 02:33:37 +01:00
|
|
|
# encrypted_password :string
|
2014-12-04 19:50:02 +01:00
|
|
|
#
|
|
|
|
|
2014-11-06 14:46:59 +01:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class UserTest < ActiveSupport::TestCase
|
2015-03-03 18:16:05 +01:00
|
|
|
def setup
|
|
|
|
@user = users(:benji)
|
|
|
|
end
|
|
|
|
|
2015-03-19 16:22:55 +01:00
|
|
|
test "debt behaves correctly" do
|
|
|
|
assert_equal @user.debt_cents, 0
|
|
|
|
assert_equal @user.debt, 0
|
2015-03-03 18:16:05 +01:00
|
|
|
|
2015-03-19 16:22:55 +01:00
|
|
|
@user.debt = 1.3
|
2015-03-03 18:16:05 +01:00
|
|
|
|
2015-03-19 16:22:55 +01:00
|
|
|
assert_equal @user.debt, 1.3
|
|
|
|
assert_equal @user.debt_cents, 130
|
2015-03-03 18:16:05 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
test "to_param" do
|
|
|
|
assert_equal @user.to_param, "#{@user.id}-benji"
|
|
|
|
end
|
2014-11-06 14:46:59 +01:00
|
|
|
end
|