Skip to content

Commit

Permalink
Merge pull request krainboltgreene#6 from lightswitch05/master
Browse files Browse the repository at this point in the history
Added a word test between 11 months and 1 year
  • Loading branch information
Kurtis Rainbolt-Greene committed Mar 8, 2013
2 parents 49bf978 + 5602b56 commit efd36f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/helper.rb
@@ -1,3 +1,4 @@
require 'coveralls'
Coveralls.wear!
require 'timecop'
require 'time-lord'
11 changes: 11 additions & 0 deletions test/lib/time-lord/period_test.rb
Expand Up @@ -6,6 +6,10 @@ def setup
@timestamp = Time.now
end

def teardown
Timecop.return # undo any time changes
end

def test_to_i_positive
expected = -100
actual = TimeLord::Period.new(@timestamp - 100, @timestamp).difference
Expand Down Expand Up @@ -42,6 +46,13 @@ def test_in_words_future_year
assert_equal(expected, actual)
end

def test_in_words_between_11_months_and_year
expected = "11 months from now"
Timecop.freeze(Time.local(2013, 1, 1))
actual = Time.local(2013, 12, 3).ago.in_words
assert_equal(expected, actual)
end

def test_math
expected = Time.now - 2.days
actual = 2.days.ago.to_time
Expand Down
1 change: 1 addition & 0 deletions time-lord.gemspec
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'kramdown'
gem.add_development_dependency 'pry'
gem.add_development_dependency 'coveralls'
gem.add_development_dependency 'timecop'
# gem.add_runtime_dependency 'gemname', '~> 1.0'
# gem.add_development_dependency 'gemname', '~> 1.0'
end

0 comments on commit efd36f8

Please sign in to comment.