Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/brain-geek/delorean into …

…brain-geek-master

Conflicts:
	Gemfile.lock
	delorean.gemspec
  • Loading branch information...
commit 952ffa3a642977848ffcafdb9b265b254d0e0434 2 parents cf6622d + 9d4f913
@cavalle cavalle authored
View
6 .travis.yml
@@ -2,4 +2,8 @@ rvm:
- 1.8.7
- 1.9.2
- 1.9.3
-
+gemfile:
+ - gemfiles/Gemfile.2.3.x
+ - gemfiles/Gemfile.3.0.x
+ - gemfiles/Gemfile.3.1.x
+ - gemfiles/Gemfile.3.2.x
View
4 Gemfile
@@ -1,6 +1,6 @@
source 'http://rubygems.org'
gemspec
-gem 'rspec', '~> 1.3.0'
-gem 'activesupport', '~> 2.3.0'
+gem 'rspec', '~> 2.9.0'
+gem 'activesupport', '> 2.3.0'
gem 'rake'
View
26 Gemfile.lock
@@ -1,22 +1,34 @@
PATH
remote: .
specs:
- delorean (1.1.1)
+ delorean (1.2.0)
chronic
GEM
remote: http://rubygems.org/
specs:
- activesupport (2.3.10)
- chronic (0.6.6)
- rake (0.8.7)
- rspec (1.3.1)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ chronic (0.6.7)
+ diff-lcs (1.1.3)
+ i18n (0.6.0)
+ multi_json (1.3.6)
+ rake (0.9.2.2)
+ rspec (2.9.0)
+ rspec-core (~> 2.9.0)
+ rspec-expectations (~> 2.9.0)
+ rspec-mocks (~> 2.9.0)
+ rspec-core (2.9.0)
+ rspec-expectations (2.9.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.9.0)
PLATFORMS
ruby
DEPENDENCIES
- activesupport (~> 2.3.0)
+ activesupport (> 2.3.0)
delorean!
rake
- rspec (~> 1.3.0)
+ rspec (~> 2.9.0)
View
9 Rakefile
@@ -1,10 +1,9 @@
require "rubygems"
-require "spec"
-require "spec/rake/spectask"
+require "rspec"
+require "rspec/core/rake_task"
-Spec::Rake::SpecTask.new do |t|
- t.spec_opts = %w(--colour)
- t.libs = ["spec"]
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = %w(--colour)
end
task :default => ["spec"]
View
4 gemfiles/Gemfile.2.3.x
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+gemspec :path => '..'
+
+gem 'activesupport', '~>2.3.0'
View
5 gemfiles/Gemfile.3.0.x
@@ -0,0 +1,5 @@
+source 'http://rubygems.org'
+gemspec :path => '..'
+
+gem 'activesupport', '~>3.0.0'
+gem 'i18n'
View
5 gemfiles/Gemfile.3.1.x
@@ -0,0 +1,5 @@
+source 'http://rubygems.org'
+gemspec :path => '..'
+
+gem 'activesupport', '~>3.1.0'
+gem 'i18n'
View
4 gemfiles/Gemfile.3.2.x
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+gemspec :path => '..'
+
+gem 'activesupport', '~>3.2.0'
View
31 spec/delorean_spec.rb
@@ -21,7 +21,7 @@
it "should travel through time" do
past_date = Time.utc(2009,1,1,10,30)
Delorean.time_travel_to past_date
- Time.now.should be_close(past_date, 1)
+ Time.now.should be_within(1).of(past_date)
end
it "should travel through time several times" do
@@ -34,14 +34,14 @@
it "should travel to string times" do
two_minutes_from_now = Time.now + 120
Delorean.time_travel_to "2 minutes from now"
- Time.now.should be_close(two_minutes_from_now, 1)
+ Time.now.should be_within(1).of(two_minutes_from_now)
end
it "should travel to string times with options" do
two_days_ago = 2.days.ago
yesterday = Chronic.parse '1 day ago'
Delorean.time_travel_to "1 day ago", :now => yesterday
- Time.now.should be_close(two_days_ago, 1)
+ Time.now.should be_within(1).of(two_days_ago)
end
it "should return the final value of the block given" do
@@ -54,14 +54,14 @@
it "should work with DateTime" do
datetime = DateTime.strptime("2011-05-25 18:00", "%Y-%m-%d %H:%M")
Delorean.time_travel_to(datetime) do
- Time.now.should be_close(datetime, 1)
+ Time.now.should be_within(1).of(datetime)
end
end
it "should change the result of DateTime" do
datetime = DateTime.strptime("2011-05-25 18:00", "%Y-%m-%d %H:%M")
Delorean.time_travel_to(datetime) do
- DateTime.now.should be_close(datetime, 1)
+ DateTime.now.should be_within(1).of(datetime)
end
end
end
@@ -92,7 +92,7 @@
it "should travel through time" do
past_date = Time.utc(2009,1,1,10,30)
Delorean.time_travel_to(past_date) do
- Time.now.should be_close(past_date, 1)
+ Time.now.should be_within(1).of(past_date)
end
end
@@ -122,7 +122,7 @@
it "should travel to string times" do
two_minutes_ago = Time.now - 120
Delorean.time_travel_to("2 minutes ago") do
- Time.now.should be_close(two_minutes_ago, 1)
+ Time.now.should be_within(1).of(two_minutes_ago)
end
end
@@ -130,7 +130,7 @@
two_days_ago = 2.days.ago
yesterday = Chronic.parse '1 day ago'
Delorean.time_travel_to("1 day ago", :now => yesterday) do
- Time.now.should be_close(two_days_ago, 1)
+ Time.now.should be_within(1).of(two_days_ago)
end
end
end
@@ -139,7 +139,7 @@
it "should jump the given number of seconds to the future" do
expected = Time.now + 60
Delorean.jump 60
- Time.now.should be_close(expected, 1)
+ Time.now.should be_within(1).of(expected)
end
it "should return the final value of the block given" do
@@ -149,5 +149,18 @@
'Marti, I need to your help to save your future children'
end.should eql 'Marti, I need to your help to save your future children'
end
+
+ it "should jump to future using rails date helpers" do
+ expected = Time.now + 60
+ Delorean.jump 1.minute
+ Time.now.should be_within(1).of(expected)
+ end
+
+ it "should jump to future using rails date helpers" do
+ expected = Time.now + 3600
+ Delorean.jump 1.hour
+ Time.now.should be_within(1).of(expected)
+ end
end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.