rubocop-rspec 2.23.0 → 2.23.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: e0eebbfb772c1598b0ee4cfe88c74d8b81171e197dbd4d5dc6020df95005440e
4
- data.tar.gz: 2936be502e0062b94a0346bd98696194fd33fe6f7693f8c92bc38a952ee31b26
3
+ metadata.gz: 2312779cc594656bb1473fc821f67c6a56ac6275c71ac536c5978a4ef4411384
4
+ data.tar.gz: 0a6419dba263c16228b454d84e25a6b066de368ebd96a98c0e2e9f66ff74f053
5
5
  SHA512:
6
- metadata.gz: 14e3e53093b7e104ab212217fdc8226a909fba9bdd84fa44c22963cf8e62d17ce858a2180b8b5b3727b5dd2a74a9b4c6e2139d8d61cbc6595b2c46f9022214af
7
- data.tar.gz: 9408c50d35ae50e1825fef43f2c6a6def0d87e44bfbbd968bb19996b1a867f215df36ab62d451af892e6855c4330c0d4fb9d09b8400ff5f35b4ecef1cfb86adb
6
+ metadata.gz: 1ed0d4251d930a51e2214b200f5720fa7f75b839e40164a6461992ee01e22518e435d12f2cd3c626f0af24c47b435bfce4f80765eadc1540e848c993a97cfae9
7
+ data.tar.gz: a74d40480225c7b693f33ff4237a19eb44188f6b634ee60cbec96cf89d03b356b61fa5130c2939a17a23331390edbe0b9f7ed4f6a2e08606bbe88d69b9631bf0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 2.23.2 (2023-08-09)
6
+
7
+ - Fix an incorrect autocorrect for `RSpec/ReceiveMessages` when method is only non-word character. ([@marocchino])
8
+ - Fix a false positive for `RSpec/ReceiveMessages` when return with splat. ([@marocchino])
9
+
10
+ ## 2.23.1 (2023-08-07)
11
+
12
+ - Mark to `Safe: false` for `RSpec/Rails/NegationBeValid` cop. ([@ydah])
13
+ - Declare autocorrect as unsafe for `RSpec/ReceiveMessages`. ([@bquorning])
14
+
5
15
  ## 2.23.0 (2023-07-30)
6
16
 
7
17
  - Add new `RSpec/Rails/NegationBeValid` cop. ([@ydah])
@@ -838,6 +848,7 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
838
848
  [@lokhi]: https://github.com/lokhi
839
849
  [@luke-hill]: https://github.com/luke-hill
840
850
  [@m-yamashita01]: https://github.com/M-Yamashita01
851
+ [@marocchino]: https://github.com/marocchino
841
852
  [@miguelfteixeira]: https://github.com/miguelfteixeira
842
853
  [@mkenyon]: https://github.com/mkenyon
843
854
  [@mkrawc]: https://github.com/mkrawc
data/config/default.yml CHANGED
@@ -733,6 +733,7 @@ RSpec/ReceiveCounts:
733
733
  RSpec/ReceiveMessages:
734
734
  Description: Checks for multiple messages stubbed on the same object.
735
735
  Enabled: pending
736
+ SafeAutoCorrect: false
736
737
  VersionAdded: '2.23'
737
738
  Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveMessages
738
739
 
@@ -1108,6 +1109,7 @@ RSpec/Rails/MinitestAssertions:
1108
1109
 
1109
1110
  RSpec/Rails/NegationBeValid:
1110
1111
  Description: Enforces use of `be_invalid` or `not_to` for negated be_valid.
1112
+ Safe: false
1111
1113
  EnforcedStyle: not_to
1112
1114
  SupportedStyles:
1113
1115
  - not_to
@@ -6,6 +6,10 @@ module RuboCop
6
6
  module Rails
7
7
  # Enforces use of `be_invalid` or `not_to` for negated be_valid.
8
8
  #
9
+ # @safety
10
+ # This cop is unsafe because it cannot guarantee that
11
+ # the test target is an instance of `ActiveModel::Validations``.
12
+ #
9
13
  # @example EnforcedStyle: not_to (default)
10
14
  # # bad
11
15
  # expect(foo).to be_invalid
@@ -5,6 +5,11 @@ module RuboCop
5
5
  module RSpec
6
6
  # Checks for multiple messages stubbed on the same object.
7
7
  #
8
+ # @safety
9
+ # The autocorrection is marked as unsafe, because it may change the
10
+ # order of stubs. This in turn may cause e.g. variables to be called
11
+ # before they are defined.
12
+ #
8
13
  # @example
9
14
  # # bad
10
15
  # before do
@@ -32,7 +37,7 @@ module RuboCop
32
37
 
33
38
  # @!method allow_receive_message?(node)
34
39
  def_node_matcher :allow_receive_message?, <<~PATTERN
35
- (send (send nil? :allow ...) :to (send (send nil? :receive (sym _)) :and_return !#heredoc?))
40
+ (send (send nil? :allow ...) :to (send (send nil? :receive (sym _)) :and_return !#heredoc_or_splat?))
36
41
  PATTERN
37
42
 
38
43
  # @!method allow_argument(node)
@@ -142,12 +147,13 @@ module RuboCop
142
147
  range_by_whole_lines(item.source_range, include_final_newline: true)
143
148
  end
144
149
 
145
- def heredoc?(node)
146
- (node.str_type? || node.dstr_type?) && node.heredoc?
150
+ def heredoc_or_splat?(node)
151
+ (node.str_type? || node.dstr_type?) && node.heredoc? ||
152
+ node.splat_type?
147
153
  end
148
154
 
149
155
  def requires_quotes?(value)
150
- value.match?(/^:".*?"|=$/)
156
+ value.match?(/^:".*?"|=$|^\W+$/)
151
157
  end
152
158
  end
153
159
  end
@@ -51,7 +51,8 @@ module RuboCop
51
51
  parent = expect.parent
52
52
  return true unless parent
53
53
  return true if parent.begin_type?
54
- return true if parent.block_type? && parent.body == expect
54
+
55
+ true if parent.block_type? && parent.body == expect
55
56
  end
56
57
  end
57
58
  end
@@ -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 = '2.23.0'
7
+ STRING = '2.23.2'
8
8
  end
9
9
  end
10
10
  end
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: 2.23.0
4
+ version: 2.23.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: 2023-07-30 00:00:00.000000000 Z
13
+ date: 2023-08-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop