Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lets get with the times and start using minitest

  • Loading branch information...
commit 82863e52529c9a3475af216e1532e541680bbaea 1 parent 3f17281
Lee Jarvis authored
View
1  HISTORY.md
@@ -1,5 +1,6 @@
# HEAD
+* Start using minitest for testing
* Ensure periods are interpreted as colons (#81).
* Support month/day and day/month parsing (#59).
View
3  chronic.gemspec
@@ -14,4 +14,7 @@ Gem::Specification.new do |s|
s.extra_rdoc_files = %w[README.md HISTORY.md LICENSE]
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test`.split("\n")
+
+ s.add_development_dependency 'rake'
+ s.add_development_dependency 'minitest'
end
View
8 test/helper.rb
@@ -3,4 +3,10 @@
require 'chronic'
end
-require 'test/unit'
+require 'minitest/autorun'
+
+class TestCase < MiniTest::Unit::TestCase
+ def self.test(name, &block)
+ define_method("test_#{name.gsub(/\W/, '_')}", &block) if block
+ end
+end
View
8 test/test_chronic.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestChronic < Test::Unit::TestCase
+class TestChronic < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
@@ -135,11 +135,7 @@ def test_day_overflow
assert_equal Time.local(2004, 3, 4), Chronic.construct(2004, 2, 33)
assert_equal Time.local(2000, 3, 4), Chronic.construct(2000, 2, 33)
- assert_nothing_raised do
- Chronic.construct(2006, 1, 56)
- end
-
- assert_raise(RuntimeError) do
+ assert_raises(RuntimeError) do
Chronic.construct(2006, 1, 57)
end
end
View
2  test/test_daylight_savings.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestDaylightSavings < Test::Unit::TestCase
+class TestDaylightSavings < TestCase
def setup
@begin_daylight_savings = Time.local(2008, 3, 9, 5, 0, 0, 0)
View
2  test/test_handler.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestHandler < Test::Unit::TestCase
+class TestHandler < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
View
18 test/test_mini_date.rb
@@ -1,32 +1,32 @@
require 'helper'
-class TestMiniDate < Test::Unit::TestCase
+class TestMiniDate < TestCase
def test_valid_month
- assert_raise(ArgumentError){ Chronic::MiniDate.new(0,12) }
- assert_raise(ArgumentError){ Chronic::MiniDate.new(13,1) }
+ assert_raises(ArgumentError){ Chronic::MiniDate.new(0,12) }
+ assert_raises(ArgumentError){ Chronic::MiniDate.new(13,1) }
end
-
+
def test_is_between
m=Chronic::MiniDate.new(3,2)
assert m.is_between?(Chronic::MiniDate.new(2,4), Chronic::MiniDate.new(4,7))
- assert !m.is_between?(Chronic::MiniDate.new(1,5), Chronic::MiniDate.new(2,7))
-
+ assert !m.is_between?(Chronic::MiniDate.new(1,5), Chronic::MiniDate.new(2,7))
+
#There was a hang if date tested is in december and outside the testing range
m=Chronic::MiniDate.new(12,24)
assert !m.is_between?(Chronic::MiniDate.new(10,1), Chronic::MiniDate.new(12,21))
end
-
+
def test_is_between_short_range
m=Chronic::MiniDate.new(5,10)
assert m.is_between?(Chronic::MiniDate.new(5,3), Chronic::MiniDate.new(5,12))
assert !m.is_between?(Chronic::MiniDate.new(5,11), Chronic::MiniDate.new(5,15))
end
-
+
def test_is_between_wrapping_range
m=Chronic::MiniDate.new(1,1)
assert m.is_between?(Chronic::MiniDate.new(11,11), Chronic::MiniDate.new(2,2))
m=Chronic::MiniDate.new(12,12)
assert m.is_between?(Chronic::MiniDate.new(11,11), Chronic::MiniDate.new(1,5))
end
-
+
end
View
2  test/test_numerizer.rb
@@ -1,6 +1,6 @@
require 'helper'
-class ParseNumbersTest < Test::Unit::TestCase
+class ParseNumbersTest < TestCase
def test_straight_parsing
strings = {
View
8 test/test_parsing.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestParsing < Test::Unit::TestCase
+class TestParsing < TestCase
# Wed Aug 16 14:00:00 UTC 2006
TIME_2006_08_16_14_00_00 = Time.local(2006, 8, 16, 14, 0, 0, 0)
@@ -866,11 +866,11 @@ def test_a_p
end
def test_argument_validation
- assert_raise(ArgumentError) do
+ assert_raises(ArgumentError) do
time = Chronic.parse("may 27", :foo => :bar)
end
- assert_raise(ArgumentError) do
+ assert_raises(ArgumentError) do
time = Chronic.parse("may 27", :context => :bar)
end
end
@@ -926,7 +926,7 @@ def test_now_changes
t1 = Chronic.parse("now")
sleep 0.1
t2 = Chronic.parse("now")
- assert_not_equal t1, t2
+ refute_equal t1, t2
end
def test_noon
View
2  test/test_repeater_day_name.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterDayName < Test::Unit::TestCase
+class TestRepeaterDayName < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_repeater_fortnight.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterFortnight < Test::Unit::TestCase
+class TestRepeaterFortnight < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_repeater_hour.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterHour < Test::Unit::TestCase
+class TestRepeaterHour < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_repeater_minute.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterMinute < Test::Unit::TestCase
+class TestRepeaterMinute < TestCase
def setup
@now = Time.local(2008, 6, 25, 7, 15, 30, 0)
View
2  test/test_repeater_month.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterMonth < Test::Unit::TestCase
+class TestRepeaterMonth < TestCase
def setup
# Wed Aug 16 14:00:00 2006
View
2  test/test_repeater_month_name.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterMonthName < Test::Unit::TestCase
+class TestRepeaterMonthName < TestCase
def setup
# Wed Aug 16 14:00:00 2006
View
2  test/test_repeater_season.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterSeason < Test::Unit::TestCase
+class TestRepeaterSeason < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_repeater_time.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterTime < Test::Unit::TestCase
+class TestRepeaterTime < TestCase
def setup
# Wed Aug 16 14:00:00 2006
View
2  test/test_repeater_week.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterWeek < Test::Unit::TestCase
+class TestRepeaterWeek < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_repeater_weekday.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterWeekday < Test::Unit::TestCase
+class TestRepeaterWeekday < TestCase
def setup
@now = Time.local(2007, 6, 11, 14, 0, 0, 0) # Mon
View
2  test/test_repeater_weekend.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterWeekend < Test::Unit::TestCase
+class TestRepeaterWeekend < TestCase
def setup
# Wed Aug 16 14:00:00 2006
View
2  test/test_repeater_year.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestRepeaterYear < Test::Unit::TestCase
+class TestRepeaterYear < TestCase
def setup
@now = Time.local(2006, 8, 16, 14, 0, 0, 0)
View
2  test/test_span.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestSpan < Test::Unit::TestCase
+class TestSpan < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
View
2  test/test_token.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestToken < Test::Unit::TestCase
+class TestToken < TestCase
def setup
# Wed Aug 16 14:00:00 UTC 2006
Please sign in to comment.
Something went wrong with that request. Please try again.