rspec-activejob 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +2 -1
- data/lib/rspec/active_job/matchers.rb +7 -5
- data/lib/rspec/active_job/version.rb +1 -1
- data/rspec-activejob.gemspec +1 -0
- data/spec/rspec/active_job/matchers_spec.rb +4 -2
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57742790063ccf2ed6cd10e683e20389dbac437
|
4
|
+
data.tar.gz: 231a686b90f41591f5ad437e8beaec9421ae8144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95a86346e700b872030feb2d8046e9bfd6c33f9419709186caaee85a49807f72dc51a4e641e13e308fc740053731278b3fb4dc70f278824b44e01276137b8c6
|
7
|
+
data.tar.gz: 38fedfe32066a157dd1b8b5e77edc9221889acbadf4a81fdaf14309cb58e08bfaa5efad2ec8044afeb2f051764ba7587e2376e67dd8c47a69cea51a3b4d6ef0d
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile.lock
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rspec/mocks/argument_list_matcher'
|
2
|
+
|
1
3
|
module RSpec
|
2
4
|
module ActiveJob
|
3
5
|
module Matchers
|
@@ -15,7 +17,7 @@ module RSpec
|
|
15
17
|
def with(*args)
|
16
18
|
raise "Must specify the job class when specifying arguments" unless job_class
|
17
19
|
|
18
|
-
@
|
20
|
+
@argument_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(*args)
|
19
21
|
self
|
20
22
|
end
|
21
23
|
|
@@ -28,7 +30,7 @@ module RSpec
|
|
28
30
|
return "expected to enqueue a #{job_class}, enqueued a #{enqueued_jobs.last[:job]}"
|
29
31
|
end
|
30
32
|
|
31
|
-
"expected to enqueue a #{job_class} with #{expected_args}, but enqueued with " \
|
33
|
+
"expected to enqueue a #{job_class} with #{argument_list_matcher.expected_args}, but enqueued with " \
|
32
34
|
"#{new_jobs_with_correct_class.first[:args]}"
|
33
35
|
end
|
34
36
|
|
@@ -38,7 +40,7 @@ module RSpec
|
|
38
40
|
|
39
41
|
private
|
40
42
|
|
41
|
-
attr_reader :before_count, :after_count, :job_class, :
|
43
|
+
attr_reader :before_count, :after_count, :job_class, :argument_list_matcher
|
42
44
|
|
43
45
|
def enqueued_something?
|
44
46
|
new_jobs.any?
|
@@ -50,7 +52,7 @@ module RSpec
|
|
50
52
|
end
|
51
53
|
|
52
54
|
def with_correct_args?
|
53
|
-
return true unless
|
55
|
+
return true unless argument_list_matcher
|
54
56
|
new_jobs_with_correct_class_and_args.any?
|
55
57
|
end
|
56
58
|
|
@@ -63,7 +65,7 @@ module RSpec
|
|
63
65
|
end
|
64
66
|
|
65
67
|
def new_jobs_with_correct_class_and_args
|
66
|
-
new_jobs_with_correct_class.select { |job| job[:args]
|
68
|
+
new_jobs_with_correct_class.select { |job| argument_list_matcher.args_match?(*job[:args]) }
|
67
69
|
end
|
68
70
|
|
69
71
|
def enqueued_jobs
|
data/rspec-activejob.gemspec
CHANGED
@@ -51,9 +51,11 @@ RSpec.describe RSpec::ActiveJob::Matchers::EnqueueA do
|
|
51
51
|
context "with argument expectations" do
|
52
52
|
let(:job_class) { AJob }
|
53
53
|
let(:instance) { described_class.new(job_class).with(*arguments) }
|
54
|
-
let(:arguments) { [
|
54
|
+
let(:arguments) { [instance_of(BJob), hash_including(thing: 1)] }
|
55
55
|
|
56
|
-
let(:proc)
|
56
|
+
let(:proc) do
|
57
|
+
-> { enqueued_jobs << { job: AJob, args: [BJob.new, { thing: 1, 'thing' => 2 }] } }
|
58
|
+
end
|
57
59
|
|
58
60
|
it { is_expected.to be(true) }
|
59
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Seymour
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-mocks
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,6 +75,7 @@ executables: []
|
|
61
75
|
extensions: []
|
62
76
|
extra_rdoc_files: []
|
63
77
|
files:
|
78
|
+
- .gitignore
|
64
79
|
- Gemfile
|
65
80
|
- Gemfile.lock
|
66
81
|
- README.md
|