backgrounded 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION.yml +1 -1
- data/backgrounded.gemspec +29 -30
- data/lib/backgrounded/class_methods.rb +1 -0
- data/lib/backgrounded/handler/no_op_handler.rb +11 -0
- data/test/backgrounded/handler/resque_handler_test.rb +4 -2
- data/test/backgrounded_test.rb +5 -2
- data/test/test_helper.rb +0 -1
- metadata +11 -9
- data/.gitignore +0 -8
data/Rakefile
CHANGED
@@ -12,10 +12,10 @@ begin
|
|
12
12
|
gem.add_runtime_dependency "activerecord", ">= 2.2.3"
|
13
13
|
gem.add_runtime_dependency "activesupport", ">= 2.2.3"
|
14
14
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
15
|
-
gem.add_development_dependency 'resque_unit', ">= 0"
|
15
|
+
gem.add_development_dependency 'resque_unit', ">= 0.3.1"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
18
|
-
Jeweler::
|
18
|
+
Jeweler::RubygemsDotOrgTasks.new
|
19
19
|
rescue LoadError
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
21
|
end
|
data/VERSION.yml
CHANGED
data/backgrounded.gemspec
CHANGED
@@ -1,51 +1,50 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{backgrounded}
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Sonnek"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-12-09}
|
13
13
|
s.email = %q{ryan.sonnek@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
16
|
-
|
16
|
+
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
19
|
+
"LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION.yml",
|
23
|
+
"backgrounded.gemspec",
|
24
|
+
"lib/backgrounded.rb",
|
25
|
+
"lib/backgrounded/class_methods.rb",
|
26
|
+
"lib/backgrounded/handler/delayed_job_handler.rb",
|
27
|
+
"lib/backgrounded/handler/inprocess_handler.rb",
|
28
|
+
"lib/backgrounded/handler/no_op_handler.rb",
|
29
|
+
"lib/backgrounded/handler/resque_handler.rb",
|
30
|
+
"lib/backgrounded/handler/workling_handler.rb",
|
31
|
+
"test/backgrounded/handler/delayed_job_handler_test.rb",
|
32
|
+
"test/backgrounded/handler/resque_handler_test.rb",
|
33
|
+
"test/backgrounded/handler/workling_handler_test.rb",
|
34
|
+
"test/backgrounded_test.rb",
|
35
|
+
"test/database.yml",
|
36
|
+
"test/test_helper.rb"
|
37
37
|
]
|
38
38
|
s.homepage = %q{http://github.com/wireframe/backgrounded}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
39
|
s.require_paths = ["lib"]
|
41
40
|
s.rubygems_version = %q{1.3.7}
|
42
41
|
s.summary = %q{Simple API to run Model methods in the background}
|
43
42
|
s.test_files = [
|
44
43
|
"test/backgrounded/handler/delayed_job_handler_test.rb",
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
"test/backgrounded/handler/resque_handler_test.rb",
|
45
|
+
"test/backgrounded/handler/workling_handler_test.rb",
|
46
|
+
"test/backgrounded_test.rb",
|
47
|
+
"test/test_helper.rb"
|
49
48
|
]
|
50
49
|
|
51
50
|
if s.respond_to? :specification_version then
|
@@ -56,18 +55,18 @@ Gem::Specification.new do |s|
|
|
56
55
|
s.add_runtime_dependency(%q<activerecord>, [">= 2.2.3"])
|
57
56
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.2.3"])
|
58
57
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
59
|
-
s.add_development_dependency(%q<resque_unit>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<resque_unit>, [">= 0.3.1"])
|
60
59
|
else
|
61
60
|
s.add_dependency(%q<activerecord>, [">= 2.2.3"])
|
62
61
|
s.add_dependency(%q<activesupport>, [">= 2.2.3"])
|
63
62
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
64
|
-
s.add_dependency(%q<resque_unit>, [">= 0"])
|
63
|
+
s.add_dependency(%q<resque_unit>, [">= 0.3.1"])
|
65
64
|
end
|
66
65
|
else
|
67
66
|
s.add_dependency(%q<activerecord>, [">= 2.2.3"])
|
68
67
|
s.add_dependency(%q<activesupport>, [">= 2.2.3"])
|
69
68
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
70
|
-
s.add_dependency(%q<resque_unit>, [">= 0"])
|
69
|
+
s.add_dependency(%q<resque_unit>, [">= 0.3.1"])
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')
|
2
2
|
require 'backgrounded/handler/resque_handler'
|
3
|
+
require 'resque_unit'
|
3
4
|
|
4
5
|
ActiveRecord::Schema.define(:version => 1) do
|
5
6
|
create_table :users, :force => true do |t|
|
@@ -48,7 +49,7 @@ class ResqueHandlerTest < Test::Unit::TestCase
|
|
48
49
|
Blog.do_stuff_backgrounded
|
49
50
|
end
|
50
51
|
should "enqueue job to resque" do
|
51
|
-
assert_queued Backgrounded::Handler::ResqueHandler
|
52
|
+
assert_queued Backgrounded::Handler::ResqueHandler, [Blog.to_s, -1, 'do_stuff']
|
52
53
|
assert_equal Backgrounded::Handler::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Handler::ResqueHandler)
|
53
54
|
end
|
54
55
|
context "running background job" do
|
@@ -70,7 +71,7 @@ class ResqueHandlerTest < Test::Unit::TestCase
|
|
70
71
|
@user.do_stuff_backgrounded
|
71
72
|
end
|
72
73
|
should "enqueue job to resque" do
|
73
|
-
assert_queued Backgrounded::Handler::ResqueHandler
|
74
|
+
assert_queued Backgrounded::Handler::ResqueHandler, [User.to_s, @user.id, 'do_stuff']
|
74
75
|
assert_equal Backgrounded::Handler::ResqueHandler::DEFAULT_QUEUE, Resque.queue_from_class(Backgrounded::Handler::ResqueHandler)
|
75
76
|
end
|
76
77
|
context "running background job" do
|
@@ -92,6 +93,7 @@ class ResqueHandlerTest < Test::Unit::TestCase
|
|
92
93
|
should "use configured queue" do
|
93
94
|
assert_equal 'important', Backgrounded::Handler::ResqueHandler.queue
|
94
95
|
assert_equal 'important', Resque.queue_from_class(Backgrounded::Handler::ResqueHandler)
|
96
|
+
assert_equal 1, Resque.queue('important').length
|
95
97
|
end
|
96
98
|
end
|
97
99
|
end
|
data/test/backgrounded_test.rb
CHANGED
@@ -69,10 +69,13 @@ class BackgroundedTest < Test::Unit::TestCase
|
|
69
69
|
end
|
70
70
|
context 'executing backgrounded method' do
|
71
71
|
setup do
|
72
|
-
@user.expects(:do_stuff)
|
73
|
-
@user.do_stuff_backgrounded
|
72
|
+
@user.expects(:do_stuff).returns(true)
|
73
|
+
@result = @user.do_stuff_backgrounded
|
74
74
|
end
|
75
75
|
should "execute method in background" do end #see expectations
|
76
|
+
should 'return nil for backgrounded method' do
|
77
|
+
assert_nil @result
|
78
|
+
end
|
76
79
|
end
|
77
80
|
end
|
78
81
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backgrounded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 1
|
10
|
+
version: 0.7.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-09 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -72,10 +72,12 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
hash:
|
75
|
+
hash: 17
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
|
78
|
+
- 3
|
79
|
+
- 1
|
80
|
+
version: 0.3.1
|
79
81
|
type: :development
|
80
82
|
version_requirements: *id004
|
81
83
|
description:
|
@@ -88,7 +90,6 @@ extra_rdoc_files:
|
|
88
90
|
- LICENSE
|
89
91
|
- README.rdoc
|
90
92
|
files:
|
91
|
-
- .gitignore
|
92
93
|
- LICENSE
|
93
94
|
- README.rdoc
|
94
95
|
- Rakefile
|
@@ -98,6 +99,7 @@ files:
|
|
98
99
|
- lib/backgrounded/class_methods.rb
|
99
100
|
- lib/backgrounded/handler/delayed_job_handler.rb
|
100
101
|
- lib/backgrounded/handler/inprocess_handler.rb
|
102
|
+
- lib/backgrounded/handler/no_op_handler.rb
|
101
103
|
- lib/backgrounded/handler/resque_handler.rb
|
102
104
|
- lib/backgrounded/handler/workling_handler.rb
|
103
105
|
- test/backgrounded/handler/delayed_job_handler_test.rb
|
@@ -111,8 +113,8 @@ homepage: http://github.com/wireframe/backgrounded
|
|
111
113
|
licenses: []
|
112
114
|
|
113
115
|
post_install_message:
|
114
|
-
rdoc_options:
|
115
|
-
|
116
|
+
rdoc_options: []
|
117
|
+
|
116
118
|
require_paths:
|
117
119
|
- lib
|
118
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|