mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Replace User#time with UserTime#time
This commit is contained in:
parent
8512e8db3b
commit
96777c2e3a
13 changed files with 44 additions and 27 deletions
|
|
@ -84,12 +84,12 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
|
||||
def test_review_project
|
||||
assert_nil @timemachine.last_reviewed
|
||||
assert @timemachine.needs_review?(nil)
|
||||
assert @timemachine.needs_review?(users(:admin_user))
|
||||
end
|
||||
|
||||
def test_review_completedprojects
|
||||
@timemachine.complete!
|
||||
assert !@timemachine.needs_review?(nil)
|
||||
assert !@timemachine.needs_review?(users(:admin_user))
|
||||
end
|
||||
|
||||
def test_complete_project
|
||||
|
|
|
|||
|
|
@ -3,11 +3,18 @@ require_relative '../../lib/staleness'
|
|||
|
||||
|
||||
class StalenessTest < Test::Unit::TestCase
|
||||
FakeUser = Struct.new(:time)
|
||||
FakePrefs = Struct.new(:time_zone)
|
||||
FakeUser = Struct.new(:time) do
|
||||
def prefs
|
||||
@prefs ||= FakePrefs.new("UTC")
|
||||
end
|
||||
end
|
||||
|
||||
FakeTask = Struct.new(:due, :completed, :created_at) do
|
||||
def completed?
|
||||
self.completed
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def now
|
||||
|
|
@ -28,6 +35,11 @@ class StalenessTest < Test::Unit::TestCase
|
|||
|
||||
def setup
|
||||
@current_user = FakeUser.new(now)
|
||||
Timecop.freeze(Time.local(2013,02,28))
|
||||
end
|
||||
|
||||
def teardown
|
||||
Timecop.return
|
||||
end
|
||||
|
||||
def test_item_with_due_date_is_not_stale_ever
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require File.expand_path('../../config/environment', __FILE__)
|
|||
require 'rails/test_help'
|
||||
|
||||
# set config for tests. Overwrite those read from config/site.yml. Use inject to avoid warning about changing CONSTANT
|
||||
{"salt" => "change-me", "authentication_schemes" => ["database"], "prefered_auth" => "database"}.inject( SITE_CONFIG ) { |h, elem| h[elem[0]] = elem[1]; h }
|
||||
{ "salt" => "change-me", "authentication_schemes" => ["database"], "prefered_auth" => "database"}.inject( SITE_CONFIG ) { |h, elem| h[elem[0]] = elem[1]; h }
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
ActiveRecord::Migration.check_pending!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue