Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…unt works again
  • Loading branch information...
commit 0eaf277a443d97e31cae6d5ccfd5ad5b60a99514 1 parent 8428fbf
Nick Quaranto qrush authored

Showing 2 changed files with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. +8 6 test/runner_test.rb
  2. +0 2  test/test_helper.rb
14 test/runner_test.rb
@@ -224,14 +224,16 @@ class RunnerTest < Test::Unit::TestCase
224 224 end
225 225
226 226 should "add to archive" do
227   - archive = "archive"
228   - mock(archive)[DateTime.now.to_s] = @runner.scores
  227 + Timecop.freeze(Date.today) do
  228 + archive = "archive"
  229 + mock(archive)[DateTime.now.to_s] = @runner.scores
229 230
230   - mock(File).exist?(@runner.archive_path) { true }
231   - mock(YAML).load_file(@runner.archive_path) { archive }
232   - mock(File).open(@runner.archive_path, "w")
  231 + mock(File).exist?(@runner.archive_path) { true }
  232 + mock(YAML).load_file(@runner.archive_path) { archive }
  233 + mock(File).open(@runner.archive_path, "w")
233 234
234   - @runner.archive
  235 + @runner.archive
  236 + end
235 237 end
236 238
237 239 should "set and create archive if it does not exist" do
2  test/test_helper.rb
@@ -9,8 +9,6 @@
9 9 rescue LoadError
10 10 end
11 11
12   -Timecop.freeze(Date.today)
13   -
14 12 $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15 13 $LOAD_PATH.unshift(File.dirname(__FILE__))
16 14 require 'pythagoras'

0 comments on commit 0eaf277

Please sign in to comment.
Something went wrong with that request. Please try again.