rspec-activejob 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 431377e4319168b42fb4104e7dc0c28a998f5133
4
- data.tar.gz: 8034829d7058af0d12e4880bf524e86f973a3dcb
3
+ metadata.gz: 8c1afc7028b16dadcb519b091b45d61a924f202e
4
+ data.tar.gz: adf02e56d10b8b7a516cbd3669428b383b34ca91
5
5
  SHA512:
6
- metadata.gz: f8adb28bccf0d2cb6931743e167a7e97ad3122a19ec108b056fb87bb5254375e8553cc8cc9c6ef96f8839f6dacd774ab00abf8ffda381c4a8777239656702199
7
- data.tar.gz: a725449f9766d47161b8831a8c8153da92c9ef58b8055b3b9f70f24c371154ec63960070e58d706b7db9620b7b3c1d36476cefc45293e5f2411df51aaab560a4
6
+ metadata.gz: 3fac8ed0f59bb88a0581f6e3f8c79ec5455d9d839238713e81b6f6cfe07c95211af2172931baa0bdc2744215fac923cdfbbdf9c47fd2055b1edb2103fa848a2c
7
+ data.tar.gz: b6bdb4aee4574375636569e68613db1e047ac5fdc357c773adb6cce1e9cfe15b5418879004702b207f5c123ca2970140745d3cdc89a70cfe359d5bbcae9cf5b4
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  # Limit lines to 90 characters.
2
4
  LineLength:
3
5
  Max: 90
@@ -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
@@ -1,3 +1,7 @@
1
+ ## 0.4.1 - May 5, 2015
2
+
3
+ - Added `failure_message_negated` for nice failure messages when a `to_not` fails
4
+
1
5
  ## 0.4.0 - April 20, 2015
2
6
 
3
7
  - Added the `have_been_enqueued` matcher
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-activejob (0.4.0)
4
+ rspec-activejob (0.4.1)
5
5
  activejob (>= 4.2)
6
6
  rspec-mocks
7
7
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module ActiveJob
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
5
5
  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
- -> { enqueued_jobs << { job: AJob, args: [BJob.new, { thing: 1, 'thing' => 2 }] } }
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) { [{ job: AJob, args: [BJob.new, { thing: 1, 'thing' => 2}] }] }
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.0
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-04-20 00:00:00.000000000 Z
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