delayed_job 2.0.8 → 2.1.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/README.textile +14 -58
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/benchmarks.rb +33 -0
- data/delayed_job.gemspec +125 -0
- data/init.rb +1 -0
- data/lib/delayed/backend/active_record.rb +11 -13
- data/lib/delayed/backend/base.rb +14 -58
- data/lib/delayed/backend/couch_rest.rb +109 -0
- data/lib/delayed/backend/data_mapper.rb +8 -12
- data/lib/delayed/backend/mongo_mapper.rb +8 -12
- data/lib/delayed/command.rb +3 -8
- data/lib/delayed/message_sending.rb +10 -19
- data/lib/delayed/performable_method.rb +5 -48
- data/lib/delayed/railtie.rb +4 -0
- data/lib/delayed/recipes.rb +5 -24
- data/lib/delayed/worker.rb +26 -27
- data/lib/delayed/yaml_ext.rb +40 -0
- data/lib/delayed_job.rb +1 -1
- data/lib/generators/delayed_job/delayed_job_generator.rb +34 -0
- data/lib/generators/delayed_job/templates/migration.rb +21 -0
- data/lib/generators/delayed_job/templates/script +5 -0
- data/spec/autoloaded/clazz.rb +7 -0
- data/spec/autoloaded/struct.rb +7 -0
- data/spec/backend/couch_rest_job_spec.rb +15 -0
- data/spec/backend/mongo_mapper_job_spec.rb +11 -11
- data/spec/backend/shared_backend_spec.rb +41 -109
- data/spec/message_sending_spec.rb +1 -46
- data/spec/performable_method_spec.rb +22 -45
- data/spec/sample_jobs.rb +0 -1
- data/spec/setup/couch_rest.rb +7 -0
- data/spec/spec_helper.rb +6 -3
- data/spec/worker_spec.rb +6 -29
- metadata +174 -260
- data/lib/delayed/deserialization_error.rb +0 -4
- data/spec/delayed_method_spec.rb +0 -46
- data/spec/story_spec.rb +0 -17
data/spec/delayed_method_spec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Object do
|
4
|
-
before { Delayed::Job.delete_all }
|
5
|
-
|
6
|
-
it "should call #delay on methods which are wrapped with handle_asynchronously" do
|
7
|
-
story = Story.create :text => 'Once upon...'
|
8
|
-
|
9
|
-
Delayed::Job.count.should == 0
|
10
|
-
|
11
|
-
story.whatever(1, 5)
|
12
|
-
|
13
|
-
Delayed::Job.count.should == 1
|
14
|
-
job = Delayed::Job.first
|
15
|
-
job.payload_object.class.should == Delayed::PerformableMethod
|
16
|
-
job.payload_object.method.should == :whatever_without_delay
|
17
|
-
job.payload_object.args.should == [1, 5]
|
18
|
-
job.payload_object.perform.should == 'Once upon...'
|
19
|
-
end
|
20
|
-
|
21
|
-
context "delay" do
|
22
|
-
it "should raise a ArgumentError if target method doesn't exist" do
|
23
|
-
lambda { Object.new.delay.method_that_does_not_exist }.should raise_error(NoMethodError)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should add a new entry to the job table when delay is called on it" do
|
27
|
-
lambda { Object.new.delay.to_s }.should change { Delayed::Job.count }.by(1)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should add a new entry to the job table when delay is called on the class" do
|
31
|
-
lambda { Object.delay.to_s }.should change { Delayed::Job.count }.by(1)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should set job options" do
|
35
|
-
run_at = 1.day.from_now
|
36
|
-
job = Object.delay(:priority => 20, :run_at => run_at).to_s
|
37
|
-
job.run_at.should == run_at
|
38
|
-
job.priority.should == 20
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should save args for original method" do
|
42
|
-
job = 3.delay.+(5)
|
43
|
-
job.payload_object.args.should == [5]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/spec/story_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "A story" do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@story = Story.create :text => "Once upon a time..."
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should be shared" do
|
10
|
-
@story.tell.should == 'Once upon a time...'
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should not return its result if it storytelling is delayed" do
|
14
|
-
@story.delay.tell.should_not == 'Once upon a time...'
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|