delayed_job 2.0.8 → 2.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +0,0 @@
1
- module Delayed
2
- class DeserializationError < StandardError
3
- end
4
- end
@@ -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