resque-mock 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/resque/mock.rb +2 -0
  2. data/spec/mock_spec.rb +16 -1
  3. metadata +51 -44
@@ -26,6 +26,8 @@ module Resque
26
26
  end
27
27
 
28
28
  def defer(klass, args, delay = nil)
29
+ validate(klass)
30
+
29
31
  if @async
30
32
  add_job('payload' => { 'class' => klass, 'args' => args }, 'delay' => delay)
31
33
  else
@@ -1,9 +1,12 @@
1
- #require 'spec_helper'
2
1
  require 'resque/mock'
3
2
 
4
3
  Resque.mock!
5
4
 
6
5
  class Performer
6
+ def self.queue
7
+ 'performings'
8
+ end
9
+
7
10
  def self.run?
8
11
  !!@args
9
12
  end
@@ -41,10 +44,22 @@ class BadPerformer < Performer
41
44
  end
42
45
  end
43
46
 
47
+ class QueuelessPerformer < Performer
48
+ class << self
49
+ undef :queue
50
+ end
51
+ end
52
+
44
53
  describe Resque do
45
54
  before { Performer.reset! }
46
55
 
47
56
  describe "synchronously" do
57
+ it "ensures the queue can be determined" do
58
+ expect {
59
+ Resque.enqueue(QueuelessPerformer, 'hello', 'there')
60
+ }.to raise_error(Resque::NoQueueError)
61
+ end
62
+
48
63
  it "performs jobs without delay" do
49
64
  Resque.enqueue(Performer, 'hello', 'there')
50
65
  Performer.should be_run
metadata CHANGED
@@ -1,85 +1,92 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque-mock
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.1.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Dan Peterson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-16 00:00:00.000000000 -07:00
12
+
13
+ date: 2011-06-27 00:00:00 -03:00
13
14
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
16
17
  name: resque
17
- requirement: &2169208800 !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
18
20
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
23
25
  type: :runtime
24
- prerelease: false
25
- version_requirements: *2169208800
26
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
27
28
  name: rake
28
- requirement: &2169208360 !ruby/object:Gem::Requirement
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
29
31
  none: false
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
34
36
  type: :development
35
- prerelease: false
36
- version_requirements: *2169208360
37
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
38
39
  name: rspec
39
- requirement: &2169207940 !ruby/object:Gem::Requirement
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
40
42
  none: false
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: '0'
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
45
47
  type: :development
46
- prerelease: false
47
- version_requirements: *2169207940
48
+ version_requirements: *id003
48
49
  description: Mock resque with threads
49
- email:
50
+ email:
50
51
  - dpiddy@gmail.com
51
52
  executables: []
53
+
52
54
  extensions: []
55
+
53
56
  extra_rdoc_files: []
54
- files:
57
+
58
+ files:
55
59
  - lib/resque/mock.rb
56
60
  - Rakefile
57
61
  - spec/mock_spec.rb
58
62
  has_rdoc: true
59
63
  homepage: https://github.com/dpiddy/resque-mock
60
64
  licenses: []
65
+
61
66
  post_install_message:
62
67
  rdoc_options: []
63
- require_paths:
68
+
69
+ require_paths:
64
70
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
71
+ required_ruby_version: !ruby/object:Gem::Requirement
66
72
  none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
78
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
77
83
  requirements: []
84
+
78
85
  rubyforge_project:
79
86
  rubygems_version: 1.5.2
80
87
  signing_key:
81
88
  specification_version: 3
82
89
  summary: Mock resque with threads
83
- test_files:
90
+ test_files:
84
91
  - Rakefile
85
92
  - spec/mock_spec.rb