resque_spec 0.14.3 → 0.14.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/lib/resque_spec/matchers.rb +40 -0
- data/lib/resque_spec/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -2,7 +2,7 @@ ResqueSpec
|
|
2
2
|
==========
|
3
3
|
|
4
4
|
[![Build
|
5
|
-
Status](https://travis-ci.org/leshill/resque_spec.png)](https://travis-ci.org/leshill/resque_spec
|
5
|
+
Status](https://travis-ci.org/leshill/resque_spec.png)](https://travis-ci.org/leshill/resque_spec)
|
6
6
|
|
7
7
|
A test double of Resque for RSpec and Cucumber. The code was originally based
|
8
8
|
on
|
@@ -415,6 +415,7 @@ Contributors
|
|
415
415
|
* Andrés Bravo (@andresbravog) : Replace `rspec` dependency with explicit dependencies
|
416
416
|
* Ben Woosley (@Empact) : Loosen rubygems version constraint
|
417
417
|
* Jeff Dickey (@dickeyxxx) : Remove 2.0 warnings, added Travis
|
418
|
+
* Earle Clubb (@eclubb) : `be\_queued` matcher
|
418
419
|
|
419
420
|
Copyright
|
420
421
|
=========
|
data/lib/resque_spec/matchers.rb
CHANGED
@@ -26,6 +26,46 @@ module InQueueHelper
|
|
26
26
|
|
27
27
|
end
|
28
28
|
|
29
|
+
RSpec::Matchers.define :be_queued do |*expected_args|
|
30
|
+
extend InQueueHelper
|
31
|
+
|
32
|
+
chain :times do |num_times_queued|
|
33
|
+
@times = num_times_queued
|
34
|
+
@times_info = @times == 1 ? ' once' : " #{@times} times"
|
35
|
+
end
|
36
|
+
|
37
|
+
chain :once do |num_times_queued|
|
38
|
+
@times = 1
|
39
|
+
@times_info = ' once'
|
40
|
+
end
|
41
|
+
|
42
|
+
match do |actual|
|
43
|
+
matched = queue(actual).select do |entry|
|
44
|
+
klass = entry.fetch(:class)
|
45
|
+
args = entry.fetch(:args)
|
46
|
+
klass.to_s == actual.to_s && expected_args == args
|
47
|
+
end
|
48
|
+
|
49
|
+
if @times
|
50
|
+
matched.size == @times
|
51
|
+
else
|
52
|
+
matched.size > 0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
failure_message_for_should do |actual|
|
57
|
+
"expected that #{actual} would be queued with [#{expected_args.join(', ')}]#{@times_info}"
|
58
|
+
end
|
59
|
+
|
60
|
+
failure_message_for_should_not do |actual|
|
61
|
+
"expected that #{actual} would not be queued with [#{expected_args.join(', ')}]#{@times_info}"
|
62
|
+
end
|
63
|
+
|
64
|
+
description do
|
65
|
+
"be queued with arguments of [#{expected_args.join(', ')}]#{@times_info}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
29
69
|
RSpec::Matchers.define :have_queued do |*expected_args|
|
30
70
|
extend InQueueHelper
|
31
71
|
|
data/lib/resque_spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|