Files
stopwatch/test/unit/user_test.rb
2023-11-03 15:17:22 +08:00

31 lines
666 B
Ruby

require File.expand_path('../../test_helper', __FILE__)
class UserTest < ActiveSupport::TestCase
fixtures :users, :user_preferences, :issues
setup do
@user = User.find 1
end
test "should get inactive timer state" do
refute @user.timer_running?
end
test "should start timer and get running state" do
t = Stopwatch::Timer.new @user
t.start
t.save
assert @user.timer_running?
end
test "should build time entry for issue" do
i = Issue.find 1
te = @user.todays_time_entry_for i
assert te.new_record?
assert_equal @user, te.user
assert_equal i, te.issue
assert_equal @user.today, te.spent_on
end
end