resque_spec 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,12 +15,9 @@ branch is not actively maintained.
15
15
  Install
16
16
  -------
17
17
 
18
- Install the gem
19
-
20
- % gem install resque_spec
21
-
22
- And update your Gemfile (Not using bundler? Do the necessary thing for
23
- your app's gem management)
18
+ Update your Gemfile to include `resque_spec` only in the *test* group (Not using
19
+ `bundler`? Do the necessary thing for your app's gem management and use
20
+ `bundler`. `resque_spec` is a mock API, it should only be used with your tests!)
24
21
 
25
22
  group :test do
26
23
  gem 'resque_spec'
data/Rakefile CHANGED
@@ -14,13 +14,3 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
14
14
  end
15
15
 
16
16
  task :default => :spec
17
-
18
- require 'rake/rdoctask'
19
- Rake::RDocTask.new do |rdoc|
20
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
21
-
22
- rdoc.rdoc_dir = 'rdoc'
23
- rdoc.title = "resque_spec #{version}"
24
- rdoc.rdoc_files.include('README*')
25
- rdoc.rdoc_files.include('lib/**/*.rb')
26
- end
@@ -12,11 +12,11 @@ module Resque
12
12
  raise ::Resque::NoQueueError.new("Jobs must have been placed onto a queue.") if !queue
13
13
  raise ::Resque::NoClassError.new("Jobs must have been given a class.") if klass.to_s.empty?
14
14
 
15
- old_count = ResqueSpec.queues[queue].size
15
+ old_count = ResqueSpec.queue_by_name(queue).size
16
16
 
17
17
  ResqueSpec.dequeue(queue, klass, *args)
18
18
 
19
- old_count - ResqueSpec.queues[queue].size
19
+ old_count - ResqueSpec.queue_by_name(queue).size
20
20
  end
21
21
  end
22
22
 
@@ -9,28 +9,28 @@ module ResqueSpec
9
9
  def enqueue_in(time, klass, *args)
10
10
  ResqueSpec.enqueue_in(time, klass, *args)
11
11
  end
12
-
12
+
13
13
  def remove_delayed(klass, *args)
14
14
  ResqueSpec.remove_delayed(klass, *args)
15
15
  end
16
16
  end
17
17
 
18
18
  def enqueue_at(time, klass, *args)
19
- store(schedule_queue_name(klass), :class => klass.to_s, :time => time, :args => args)
19
+ perform_or_store(schedule_queue_name(klass), :class => klass.to_s, :time => time, :args => args)
20
20
  end
21
21
 
22
22
  def enqueue_in(time, klass, *args)
23
23
  enqueue_at(Time.now + time, klass, *args)
24
24
  end
25
-
25
+
26
26
  def remove_delayed(klass, *args)
27
27
  queue_by_name(schedule_queue_name(klass)).delete_if do |job|
28
28
  job[:class] == klass.to_s && job[:args] == args
29
29
  end
30
30
  end
31
-
31
+
32
32
  def schedule_for(klass)
33
- queues[schedule_queue_name(klass)]
33
+ queue_by_name(schedule_queue_name(klass))
34
34
  end
35
35
 
36
36
  private
@@ -1,3 +1,3 @@
1
1
  module ResqueSpec
2
- VERSION = "0.6.8"
2
+ VERSION = "0.7.0"
3
3
  end
data/lib/resque_spec.rb CHANGED
@@ -14,7 +14,7 @@ module ResqueSpec
14
14
  end
15
15
 
16
16
  def enqueue(queue_name, klass, *args)
17
- store(queue_name, :class => klass.to_s, :args => args)
17
+ perform_or_store(queue_name, :class => klass.to_s, :args => args)
18
18
  end
19
19
 
20
20
  def perform_next(queue_name)
@@ -29,7 +29,7 @@ module ResqueSpec
29
29
  end
30
30
 
31
31
  def queue_by_name(name)
32
- queues[name]
32
+ queues[name.to_s]
33
33
  end
34
34
 
35
35
  def queue_for(klass)
@@ -69,14 +69,18 @@ module ResqueSpec
69
69
  Resque::Job.new(queue_name, payload_with_string_keys(payload)).perform
70
70
  end
71
71
 
72
- def store(queue_name, payload)
72
+ def perform_or_store(queue_name, payload)
73
73
  if inline
74
74
  perform(queue_name, payload)
75
75
  else
76
- queue_by_name(queue_name) << payload
76
+ store(queue_name, payload)
77
77
  end
78
78
  end
79
79
 
80
+ def store(queue_name, payload)
81
+ queue_by_name(queue_name) << payload
82
+ end
83
+
80
84
  def payload_with_string_keys(payload)
81
85
  {
82
86
  'class' => payload[:class],
metadata CHANGED
@@ -1,71 +1,66 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque_spec
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
4
5
  prerelease:
5
- version: 0.6.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Les Hill
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-24 00:00:00 -07:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: resque
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70320129935120 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 1.15.0
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70320129935120
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70320129934620 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
35
32
  version: 2.5.0
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: ruby-debug19
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70320129934620
36
+ - !ruby/object:Gem::Dependency
37
+ name: ruby-debug19
38
+ requirement: &70320129934240 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
47
44
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: timecop
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70320129934240
47
+ - !ruby/object:Gem::Dependency
48
+ name: timecop
49
+ requirement: &70320129933780 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
58
55
  type: :development
59
- version_requirements: *id004
56
+ prerelease: false
57
+ version_requirements: *70320129933780
60
58
  description: RSpec matchers for Resque
61
59
  email: leshill@gmail.com
62
60
  executables: []
63
-
64
61
  extensions: []
65
-
66
62
  extra_rdoc_files: []
67
-
68
- files:
63
+ files:
69
64
  - lib/resque_spec/ext.rb
70
65
  - lib/resque_spec/helpers.rb
71
66
  - lib/resque_spec/matchers.rb
@@ -75,33 +70,28 @@ files:
75
70
  - LICENSE
76
71
  - README.md
77
72
  - Rakefile
78
- has_rdoc: true
79
73
  homepage: http://github.com/leshill/resque_spec
80
74
  licenses: []
81
-
82
75
  post_install_message:
83
76
  rdoc_options: []
84
-
85
- require_paths:
77
+ require_paths:
86
78
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
88
80
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
86
  none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
98
90
  version: 1.3.6
99
91
  requirements: []
100
-
101
92
  rubyforge_project:
102
- rubygems_version: 1.6.2
93
+ rubygems_version: 1.8.6
103
94
  signing_key:
104
95
  specification_version: 3
105
96
  summary: RSpec matchers for Resque
106
97
  test_files: []
107
-