governor_background 0.2.1 → 0.2.2

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- governor_background (0.2.1)
4
+ governor_background (0.2.2)
5
5
  governor
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{governor_background}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Liam Morley"]
@@ -13,7 +13,7 @@ background.register_model_callback do |base|
13
13
  module InstanceMethods
14
14
  private
15
15
  def run_in_background(method, *arguments)
16
- GovernorBackground::Handler.run_in_background self, method, arguments
16
+ GovernorBackground::Handler.run_in_background self, method, *arguments
17
17
  end
18
18
  end
19
19
  base.send :include, InstanceMethods
@@ -30,24 +30,34 @@ module GovernorBackground
30
30
  @article = Factory(:article, :author => Factory(:user))
31
31
  end
32
32
 
33
- it "adds delayed jobs successfully" do
34
- expect {
35
- Handler.run_in_background(@article, :post)
36
- }.to change { ::Delayed::Job.count }.by 1
33
+ context "delayed_job" do
34
+ it "adds jobs successfully" do
35
+ expect {
36
+ Handler.run_in_background(@article, :post)
37
+ }.to change { ::Delayed::Job.count }.by 1
38
+ end
39
+
40
+ it "handles any number of arguments" do
41
+ Handler.run_in_background(@article, :post, 1, 2, 3)
42
+ performer = YAML.load ::Delayed::Job.first.handler
43
+ performer.arguments.should == [1, 2, 3]
44
+ end
37
45
  end
38
46
 
39
- it "adds resque jobs successfully" do
40
- Handler.use_resque = true
41
- Handler.run_in_background(@article, :post)
42
- id = JobManager.jobs.first.id
43
- Resque::PerformerWithState.should have_queued(id, {:resource => :articles, :id => @article.id, :method_name => :post, :arguments => []}).in(:governor)
44
- end
47
+ context "resque" do
48
+ it "adds jobs successfully" do
49
+ Handler.use_resque = true
50
+ Handler.run_in_background(@article, :post)
51
+ id = JobManager.jobs.first.id
52
+ Resque::PerformerWithState.should have_queued(id, {:resource => :articles, :id => @article.id, :method_name => :post, :arguments => []}).in(:governor)
53
+ end
45
54
 
46
- it "can accept any number of arguments" do
47
- Handler.use_resque = true
48
- Handler.run_in_background(@article, :post, 1, 2, 3)
49
- id = JobManager.jobs.first.id
50
- Resque::PerformerWithState.should have_queued(id, {:resource => :articles, :id => @article.id, :method_name => :post, :arguments => [1, 2, 3]}).in(:governor)
55
+ it "can accept any number of arguments" do
56
+ Handler.use_resque = true
57
+ Handler.run_in_background(@article, :post, 1, 2, 3)
58
+ id = JobManager.jobs.first.id
59
+ Resque::PerformerWithState.should have_queued(id, {:resource => :articles, :id => @article.id, :method_name => :post, :arguments => [1, 2, 3]}).in(:governor)
60
+ end
51
61
  end
52
62
  end
53
63
  end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe GovernorBackground do
4
4
  it "passes arguments to the handler" do
5
5
  @article = Factory(:article, :author => Factory(:user))
6
- GovernorBackground::Handler.expects(:run_in_background).with(@article, :some_method, [1, 2, 3])
6
+ GovernorBackground::Handler.expects(:run_in_background).with(@article, :some_method, 1, 2, 3)
7
7
  @article.send(:run_in_background, :some_method, 1, 2, 3)
8
8
  end
9
9
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- governor_background (0.2.1)
4
+ governor_background (0.2.2)
5
5
  governor
6
6
 
7
7
  GEM
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: governor_background
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Liam Morley