rubocop-rspec 1.22.1 → 1.22.2

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
  SHA256:
3
- metadata.gz: ace522f3766b6db17eecaffa9d4a5b2efc6f4cf81a581211afed52fb7ed18a1a
4
- data.tar.gz: d38f31b69bc99ff14ca490b0a7ad1a84284d1b30bc73d347ba01e8a90831198d
3
+ metadata.gz: 45305dc24c290781dd6ea63a81c7ec1c99badf079e3f52cce42f92da63c360b4
4
+ data.tar.gz: e2532b3fd549df87cccbd1e060f6a7dbb01b94ed290a3ee32b63961a4cfc57bd
5
5
  SHA512:
6
- metadata.gz: 8efef00f7046db8b8bf54d8585e43e999a570204aaa5b645a5b73271d84bedd7d9694ac2de40af45b457c4f5f3469a04219cb3d140d4cb6b001cb316751969f4
7
- data.tar.gz: af58c7c3e41514372c3d88dbab4e4613256b0233075b7e71ee18af6158aa14d0828c7ff0eb2f4327d75fbb74e465bd1ae57378073f5d4e23817d3ef7665b7edc
6
+ metadata.gz: 462eb5bf9cfd3aa17eddf02aca0a223fecb50f915adf6715c1484c7153b8b650b2205d9d2e6d12989c8097acd68d07e03104c6809f0ed67d901972efe9edf7ac
7
+ data.tar.gz: 01662e9fa466a98a282eb5d2256bf5f1c7c9680390c22c2b8e8af0a7eb5313dcf2ada617cda57f2d682b661ea04652548869cd711e1990f9e739df08071aa2d5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.22.2 (2018-02-01)
6
+
7
+ * Fix error in `RSpec/DescribedClass` when working on an empty `describe` block. ([@bquorning][])
8
+
5
9
  ## 1.22.1 (2018-01-17)
6
10
 
7
11
  * Fix false positives in `RSpec/ReturnFromStub`. ([@Darhazer][])
@@ -49,12 +49,12 @@ module RuboCop
49
49
  def_node_matcher :scope_changing_syntax?, '{def class module}'
50
50
 
51
51
  def on_block(node)
52
- describe, described_class, body = described_constant(node)
53
- return unless top_level_describe?(describe)
52
+ # In case the explicit style is used, we needs to remember what's
53
+ # being described. Thus, we use an ivar for @described_class.
54
+ describe, @described_class, body = described_constant(node)
54
55
 
55
- # in case we explicit style is used, this cop needs to remember what's
56
- # being described, so to replace described_class with the constant
57
- @described_class = described_class
56
+ return if body.nil?
57
+ return unless top_level_describe?(describe)
58
58
 
59
59
  find_usage(body) do |match|
60
60
  add_offense(
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '1.22.1'.freeze
7
+ STRING = '1.22.2'.freeze
8
8
  end
9
9
  end
10
10
  end
@@ -202,6 +202,13 @@ RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
202
202
  RUBY
203
203
  end
204
204
 
205
+ it 'accepts an empty block' do
206
+ expect_no_offenses(<<-RUBY)
207
+ describe MyClass do
208
+ end
209
+ RUBY
210
+ end
211
+
205
212
  include_examples 'autocorrect',
206
213
  'describe(Foo) { include Foo }',
207
214
  'describe(Foo) { include described_class }'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.1
4
+ version: 1.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-01-17 00:00:00.000000000 Z
13
+ date: 2018-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop