rspec-activejob 0.4.0 → 0.4.1
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/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +23 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/rspec/active_job/enqueue_a.rb +15 -0
- data/lib/rspec/active_job/version.rb +1 -1
- data/spec/rspec/active_job/enqueue_a_spec.rb +23 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c1afc7028b16dadcb519b091b45d61a924f202e
|
4
|
+
data.tar.gz: adf02e56d10b8b7a516cbd3669428b383b34ca91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fac8ed0f59bb88a0581f6e3f8c79ec5455d9d839238713e81b6f6cfe07c95211af2172931baa0bdc2744215fac923cdfbbdf9c47fd2055b1edb2103fa848a2c
|
7
|
+
data.tar.gz: b6bdb4aee4574375636569e68613db1e047ac5fdc357c773adb6cce1e9cfe15b5418879004702b207f5c123ca2970140745d3cdc89a70cfe359d5bbcae9cf5b4
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-05-05 20:58:29 +0100 using RuboCop version 0.27.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 16
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Max: 8
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
Metrics/PerceivedComplexity:
|
18
|
+
Max: 9
|
19
|
+
|
20
|
+
# Offense count: 1
|
21
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
22
|
+
Style/PredicateName:
|
23
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -42,6 +42,21 @@ module RSpec
|
|
42
42
|
"#{new_jobs_with_correct_class.first[:args]}"
|
43
43
|
end
|
44
44
|
|
45
|
+
def failure_message_negated
|
46
|
+
return "expected to not enqueue a job" unless job_class
|
47
|
+
|
48
|
+
message = "expected to not enqueue a #{job_class}"
|
49
|
+
if @argument_list_matcher
|
50
|
+
message += " with #{argument_list_matcher.expected_args}"
|
51
|
+
end
|
52
|
+
|
53
|
+
message += ", but enqueued a #{enqueued_jobs.last[:job]}"
|
54
|
+
|
55
|
+
return message unless enqueued_correct_class?
|
56
|
+
|
57
|
+
message + " with #{new_jobs_with_correct_class.first[:args]}"
|
58
|
+
end
|
59
|
+
|
45
60
|
def supports_block_expectations?
|
46
61
|
true
|
47
62
|
end
|
@@ -30,6 +30,12 @@ RSpec.describe RSpec::ActiveJob::Matchers::EnqueueA do
|
|
30
30
|
|
31
31
|
it { is_expected.to be(true) }
|
32
32
|
|
33
|
+
specify do
|
34
|
+
matches?
|
35
|
+
expect(instance.failure_message_negated).
|
36
|
+
to eq("expected to not enqueue a job")
|
37
|
+
end
|
38
|
+
|
33
39
|
context "when it enqueues the wrong job" do
|
34
40
|
let(:job_class) { BJob }
|
35
41
|
|
@@ -41,6 +47,17 @@ RSpec.describe RSpec::ActiveJob::Matchers::EnqueueA do
|
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
50
|
+
context "when it enqueues the right job" do
|
51
|
+
let(:job_class) { AJob }
|
52
|
+
|
53
|
+
it { is_expected.to be(true) }
|
54
|
+
specify do
|
55
|
+
matches?
|
56
|
+
expect(instance.failure_message_negated).
|
57
|
+
to eq("expected to not enqueue a AJob, but enqueued a AJob with []")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
44
61
|
context "when it enqueues two jobs" do
|
45
62
|
let(:proc) do
|
46
63
|
-> { enqueued_jobs << { job: AJob, args: [] } << { job: BJob, args: [] } }
|
@@ -56,7 +73,9 @@ RSpec.describe RSpec::ActiveJob::Matchers::EnqueueA do
|
|
56
73
|
let(:arguments) { [instance_of(BJob), hash_including(thing: 1)] }
|
57
74
|
|
58
75
|
let(:proc) do
|
59
|
-
|
76
|
+
lambda do
|
77
|
+
enqueued_jobs << { job: AJob, args: [BJob.new, { thing: 1, 'thing' => 2 }] }
|
78
|
+
end
|
60
79
|
end
|
61
80
|
|
62
81
|
it { is_expected.to be(true) }
|
@@ -112,7 +131,9 @@ RSpec.describe RSpec::ActiveJob::Matchers::EnqueueA do
|
|
112
131
|
let(:job_class) { AJob }
|
113
132
|
let(:instance) { described_class.new.with(*arguments) }
|
114
133
|
let(:arguments) { [instance_of(BJob), hash_including(thing: 1)] }
|
115
|
-
let(:enqueued_jobs)
|
134
|
+
let(:enqueued_jobs) do
|
135
|
+
[{ job: AJob, args: [BJob.new, { thing: 1, 'thing' => 2 }] }]
|
136
|
+
end
|
116
137
|
it { is_expected.to be(true) }
|
117
138
|
|
118
139
|
context "with mismatching arguments"do
|
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.4.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -92,6 +92,7 @@ extra_rdoc_files: []
|
|
92
92
|
files:
|
93
93
|
- .gitignore
|
94
94
|
- .rubocop.yml
|
95
|
+
- .rubocop_todo.yml
|
95
96
|
- CHANGELOG.md
|
96
97
|
- Gemfile
|
97
98
|
- Gemfile.lock
|