Permalink
Browse files

prepare for gemification

  • Loading branch information...
1 parent 143e240 commit 446fc1f562e35662386d02a4d509b8fa0da00db9 @ericgj committed Feb 16, 2012
Showing with 295 additions and 250 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 Gemfile
  3. +2 −0 lib/tempr.rb
  4. 0 lib/{ → tempr}/date_time_range.rb
  5. +9 −0 lib/tempr/version.rb
  6. +20 −0 tempr.gemspec
  7. +24 −21 test/at_time.rb
  8. +3 −0 test/suite.rb
  9. +3 −1 test/test_helper.rb
  10. +230 −228 test/time_subrange.rb
View
@@ -1 +1,2 @@
scratch
+Gemfile.lock
View
@@ -0,0 +1,3 @@
+source :rubygems
+
+gemspec
View
@@ -0,0 +1,2 @@
+require File.expand_path('tempr/version', File.dirname(__FILE__))
+require File.expand_path('tempr/date_time_range', File.dirname(__FILE__))
File renamed without changes.
View
@@ -0,0 +1,9 @@
+
+module Tempr
+ module Version
+ MAJOR = 0
+ MINOR = 1
+ TINY = 0
+ STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
+ end
+end
View
@@ -0,0 +1,20 @@
+require File.expand_path('lib/tempr/version',File.dirname(__FILE__))
+
+Gem::Specification.new do |s|
+ s.name = "tempr"
+ s.version = Tempr::Version::STRING
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Eric Gjertsen"]
+ s.email = ["ericgj72@gmail.com"]
+ s.homepage = "http://github.com/ericgj/tempr"
+ s.summary = "No-fussin' temporal expressions library"
+ s.description = ""
+
+ s.files = `git ls-files -c`.split("\n") - ['tempr.gemspec']
+ s.require_path = 'lib'
+ s.rubyforge_project = 'tempr'
+ s.required_rubygems_version = '>= 1.3.6'
+ s.required_ruby_version = '>= 1.9.2'
+
+ s.add_development_dependency 'minitest'
+end
View
@@ -1,33 +1,36 @@
require File.expand_path('test_helper', File.dirname(__FILE__))
-module Fixtures
+module AtTimeTests
+ module Fixtures
- BaseRanges = {:local => Time.parse('2012-01-01 00:00:00 -0500')...
- Time.parse('2013-01-01 00:00:00 -0500'),
- :utc => Time.parse('2012-01-01 00:00:00 UTC')...
- Time.parse('2013-01-01 00:00:00 UTC')
- }
-
-end
+ BaseRanges = {:local => Time.parse('2012-01-01 00:00:00 -0500')...
+ Time.parse('2013-01-01 00:00:00 -0500'),
+ :utc => Time.parse('2012-01-01 00:00:00 UTC')...
+ Time.parse('2013-01-01 00:00:00 UTC')
+ }
+
+ end
-describe 'DateTimeRange#at_time' do
+ describe 'DateTimeRange#at_time' do
- [:local, :utc].each do |time_type|
-
- describe "across daylight savings time boundaries for #{time_type} times" do
+ [:local, :utc].each do |time_type|
- let(:subject) { Fixtures::BaseRanges[time_type].extend(Tempr::DateTimeRange) }
+ describe "across daylight savings time boundaries for #{time_type} times" do
- it 'should be at the same time of day regardless of time zone' do
- subject.each_day.at_time("2:00pm",60*60).each do |range|
- offset = range.begin.utc_offset
- actual = range.begin.getlocal(offset).hour
- #puts "#{range}"
- assert_equal 14, actual, "for range: #{range}"
+ let(:subject) { Fixtures::BaseRanges[time_type].extend(Tempr::DateTimeRange) }
+
+ it 'should be at the same time of day regardless of time zone' do
+ subject.each_day.at_time("2:00pm",60*60).each do |range|
+ offset = range.begin.utc_offset
+ actual = range.begin.getlocal(offset).hour
+ #puts "#{range}"
+ assert_equal 14, actual, "for range: #{range}"
+ end
end
+
end
end
-
end
-end
+
+end # namespace
View
@@ -0,0 +1,3 @@
+%w[ time_subrange at_time ].each do |test|
+ require File.expand_path(test,File.dirname(__FILE__))
+end
View
@@ -1,4 +1,6 @@
-require File.expand_path('../lib/date_time_range', File.dirname(__FILE__))
+require File.expand_path('../lib/tempr', File.dirname(__FILE__))
+
+gem "minitest"
require 'minitest/spec'
MiniTest::Unit.autorun
Oops, something went wrong.

0 comments on commit 446fc1f

Please sign in to comment.