Permalink
Browse files

Freezing time in the should block instead of in test_helper so the co…

…unt works again
  • Loading branch information...
1 parent 8428fbf commit 0eaf277a443d97e31cae6d5ccfd5ad5b60a99514 @qrush qrush committed Jul 8, 2009
Showing with 8 additions and 8 deletions.
  1. +8 −6 test/runner_test.rb
  2. +0 −2 test/test_helper.rb
View
14 test/runner_test.rb
@@ -224,14 +224,16 @@ class RunnerTest < Test::Unit::TestCase
end
should "add to archive" do
- archive = "archive"
- mock(archive)[DateTime.now.to_s] = @runner.scores
+ Timecop.freeze(Date.today) do
+ archive = "archive"
+ mock(archive)[DateTime.now.to_s] = @runner.scores
- mock(File).exist?(@runner.archive_path) { true }
- mock(YAML).load_file(@runner.archive_path) { archive }
- mock(File).open(@runner.archive_path, "w")
+ mock(File).exist?(@runner.archive_path) { true }
+ mock(YAML).load_file(@runner.archive_path) { archive }
+ mock(File).open(@runner.archive_path, "w")
- @runner.archive
+ @runner.archive
+ end
end
should "set and create archive if it does not exist" do
View
2 test/test_helper.rb
@@ -9,8 +9,6 @@
rescue LoadError
end
-Timecop.freeze(Date.today)
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'pythagoras'

0 comments on commit 0eaf277

Please sign in to comment.