whenever-delorean 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -34,7 +34,11 @@ class WheneverDelorean
34
34
  end
35
35
 
36
36
  def run_jobs
37
- jobs.each do |job|
37
+ jobs_to_run = jobs
38
+
39
+ raise "There are no jobs to run!" if jobs_to_run.count == 0
40
+
41
+ jobs_to_run.each do |job|
38
42
  Delorean.time_travel_to(job[:time])
39
43
  eval(job[:runner])
40
44
  end
@@ -60,6 +60,17 @@ describe "WheneverDelorean" do
60
60
 
61
61
  end
62
62
 
63
+ it 'should raise an error if no job was run' do
64
+
65
+ Rails.should_receive(:root).and_return(Pathname.new("/dummy-rails-root"))
66
+ File.should_receive(:read).with(Pathname.new("/dummy-rails-root/config/schedule.rb")).and_return(%{})
67
+
68
+ lambda {
69
+ WheneverDelorean.time_travel_to("5 days from now", :only => /a_dummy_method/)
70
+ }.should raise_error("There are no jobs to run!")
71
+
72
+ end
73
+
63
74
  it 'should ignore rake tasks' do
64
75
 
65
76
  Rails.should_receive(:root).and_return(Pathname.new("/dummy-rails-root"))
@@ -99,7 +99,7 @@ describe "WheneverDelorean" do
99
99
 
100
100
  subject { WheneverDelorean.new(nil,{:only => /./}) }
101
101
 
102
- it 'should iterate all the jobs and run time at the correct time' do
102
+ it 'should iterate all the jobs and run them at the correct time' do
103
103
 
104
104
  jobs = [{:runner => "TestHelper.dummy_method1", :time => Time.new(2010,01,01)}, {:runner => "TestHelper.dummy_method1", :time => Time.new(2010,01,01)}]
105
105
 
@@ -113,6 +113,18 @@ describe "WheneverDelorean" do
113
113
  subject.send(:run_jobs)
114
114
 
115
115
  end
116
+
117
+ it 'should raise an error if there are no jobs to run' do
118
+
119
+ jobs = []
120
+
121
+ subject.should_receive(:jobs).and_return(jobs)
122
+ jobs.should_receive(:count).and_return(0)
123
+
124
+ lambda { subject.send(:run_jobs) }.should raise_error("There are no jobs to run!")
125
+
126
+ end
127
+
116
128
  end
117
129
 
118
130
  describe "#jobs" do
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "whenever-delorean"
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darwin"]
12
- s.date = "2013-04-22"
12
+ s.date = "2013-04-23"
13
13
  s.description = "Helper for integration testing. It helps you trigger your whener runners."
14
14
  s.email = "darwin.git@marianna.se"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whenever-delorean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-22 00:00:00.000000000 Z
12
+ date: 2013-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: delorean
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: 2185189826732141046
162
+ hash: 4214150363496657947
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements: