mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 17:51:59 -04:00
31 lines
666 B
Ruby
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
|