rubocop-rspec 1.25.0 → 1.25.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
  SHA256:
3
- metadata.gz: c195bc91134a73125f33d0675230a01fd467747690f3113ff3a924559d7c748c
4
- data.tar.gz: 3f9fcaedd22ab9f67542b083ef72a6ab466df04a758c84f3e244176b781a6109
3
+ metadata.gz: 3aa1fc65d7a5b5430ef4c5a88fa0daa56e09d330dd243225f3ef9b6332b076b3
4
+ data.tar.gz: 2e56f9dfd5b0b4f11ba040b032bd75ea366a10f15ac7255144971ddfd56027f3
5
5
  SHA512:
6
- metadata.gz: be3574c7d021a099bdd2869d47a908f4ac5c3ea9e12823030db025a92d24fd3d8008373b422b72e7e666cfefda0a983b3ae6d5f57e62c2dd14f99dc416d48ac3
7
- data.tar.gz: 8bcad630c6244f19a896c061c15c94dbe9611f651d72306642bb980c2aa082b0d78d54f54e3b32544b475c4cbbb8a18dbe8631105cdbec4f6d12e0b81851b8b2
6
+ metadata.gz: a6066bc29073c219f495824ddce3c3b7d2237d1d06c28605ce536c46b2ec11d0240f05438d7ff8d4a03fde39d484816eb479122617cf411dcf91caba0b2d2cad
7
+ data.tar.gz: f1d974b0e62efee91acc48eef293fee4237ebb7ec3eb25eb210808e10432be9a010867818410e99b9986e518d24d237d77709c8acea41a35b3dab225412168d8
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.25.1 (2018-04-10)
6
+
7
+ * Fix false positive in `RSpec/Pending` cop when pending is used as a method name. ([@Darhazer][])
8
+ * Fix `FactoryBot/DynamicAttributeDefinedStatically` false positive when using symbol proc argument for a sequence. ([@tdeo][])
9
+
5
10
  ## 1.25.0 (2018-04-07)
6
11
 
7
12
  * Add `RSpec/SharedExamples` cop to enforce consistent usage of string to titleize shared examples. ([@anthony-robin][])
@@ -328,3 +333,4 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
328
333
  [@jojos003]: https://github.com/jojos003
329
334
  [@abrom]: https://github.com/abrom
330
335
  [@patrickomatic]: https://github.com/patrickomatic
336
+ [@tdeo]: https://github.com/tdeo
@@ -31,14 +31,9 @@ module RuboCop
31
31
  (block (send nil? {:factory :trait} ...) _ { (begin $...) $(send ...) } )
32
32
  PATTERN
33
33
 
34
- def_node_matcher :callback_with_symbol_proc?, <<-PATTERN
35
- (send nil? {:before :after} sym (block_pass sym))
36
- PATTERN
37
-
38
34
  def on_block(node)
39
35
  factory_attributes(node).to_a.flatten.each do |attribute|
40
- next if callback_with_symbol_proc?(attribute) ||
41
- static?(attribute)
36
+ next if static_or_proc?(attribute)
42
37
  add_offense(attribute, location: :expression)
43
38
  end
44
39
  end
@@ -55,8 +50,10 @@ module RuboCop
55
50
 
56
51
  private
57
52
 
58
- def static?(attribute)
59
- value_matcher(attribute).to_a.all?(&:recursive_literal_or_const?)
53
+ def static_or_proc?(attribute)
54
+ value_matcher(attribute).to_a.all? do |value|
55
+ value.block_pass_type? || value.recursive_literal_or_const?
56
+ end
60
57
  end
61
58
 
62
59
  def value_hash_without_braces?(node)
@@ -43,8 +43,12 @@ module RuboCop
43
43
 
44
44
  def_node_matcher :pending_block?, PENDING_EXAMPLES.send_pattern
45
45
 
46
+ def_node_matcher :rspec?, '(send {(const nil? :RSpec) nil?} ...)'
47
+
46
48
  def on_send(node)
47
49
  return unless pending_block?(node) || skipped_from_metadata?(node)
50
+ return unless rspec?(node)
51
+
48
52
  add_offense(node, location: :expression)
49
53
  end
50
54
 
@@ -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.25.0'.freeze
7
+ STRING = '1.25.1'.freeze
8
8
  end
9
9
  end
10
10
  end
@@ -87,6 +87,16 @@ RSpec.describe RuboCop::Cop::RSpec::FactoryBot::DynamicAttributeDefinedStaticall
87
87
  RUBY
88
88
  end
89
89
 
90
+ it 'accepts valid sequence definition' do
91
+ expect_no_offenses(<<-RUBY)
92
+ #{factory_bot}.define do
93
+ factory :post do
94
+ sequence :negative_numbers, &:-@
95
+ end
96
+ end
97
+ RUBY
98
+ end
99
+
90
100
  bad = <<-RUBY
91
101
  #{factory_bot}.define do
92
102
  factory :post do
@@ -106,6 +106,14 @@ RSpec.describe RuboCop::Cop::RSpec::Pending do
106
106
  RUBY
107
107
  end
108
108
 
109
+ it 'flags pending examples when receiver is explicit' do
110
+ expect_offense(<<-RUBY)
111
+ RSpec.xit 'test' do
112
+ ^^^^^^^^^^^^^^^^ Pending spec found.
113
+ end
114
+ RUBY
115
+ end
116
+
109
117
  it 'does not flag describe' do
110
118
  expect_no_offenses(<<-RUBY)
111
119
  describe 'test' do; end
@@ -159,4 +167,10 @@ RSpec.describe RuboCop::Cop::RSpec::Pending do
159
167
  example_group 'test' do; end
160
168
  RUBY
161
169
  end
170
+
171
+ it 'does not flag method called pending' do
172
+ expect_no_offenses(<<-RUBY)
173
+ subject { Project.pending }
174
+ RUBY
175
+ end
162
176
  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: 1.25.0
4
+ version: 1.25.1
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-04-07 00:00:00.000000000 Z
13
+ date: 2018-04-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop