rubocop-rspec 2.13.1 → 2.13.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: beb4503a6d6d420e50748e9fd6c679a2968888d783293c33da2dbaf6d7a9fc3f
4
- data.tar.gz: 4dff5e6a61c80d1acc943169efdb65a24fa5dd05654bf758c4f6b291aedad63c
3
+ metadata.gz: f7da4fe826259c4b6981fabc58abafd9d91d121a35b538f40953af7f152dca15
4
+ data.tar.gz: fd8a448c3534ad861e218b92d198d1ca0a6375f95dfc9fdf87cb4bbfe7fd956a
5
5
  SHA512:
6
- metadata.gz: 7937a46e61db588b4b9354ec362af79585526e7d95a7bc735435ace552b44e354f32e8f10310460059b71870a1caf8617414edd663cf8b50e9f13405977123a4
7
- data.tar.gz: 7c4a57c7635e827717d10f253233837e7b9c11c5769fd4d9aab7c7c110d808f83c6099663684237c499432f606891b7a8aa9142c302e09ad5e73391b70f29a8e
6
+ metadata.gz: 5bf56052d556e623c3b7ffd93eed6dd2931c59b869de859a9f58ff8408ae87ad87a576cd53ce351c759ced16434749b4e2d18f5bfc5547c124b81c7c17432014
7
+ data.tar.gz: 0134a9c72e903bf20e60a7e0ac16cee7d9e3846e7e65832b4950d5d9dca3292e76238e6c1382984c050a07d475978efdf65b54961de3a95b11a0833b4da5f00d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 2.13.2 (2022-09-23)
6
+
7
+ * Fix an error for `RSpec/Capybara/SpecificFinders` with no parentheses. ([@ydah][])
8
+ * Fix a false positive for `RSpec/NoExpectationExample` with pending using `skip` or `pending` inside an example. ([@ydah][])
9
+ * Exclude `have_text` and `have_content` that raise `ArgumentError` with `RSpec/Capybara/VisibilityMatcher` where `:visible` is an invalid option. ([@ydah][])
10
+ * Fix a false negative for `RSpec/Capybara/VisibilityMatcher` with negative matchers. ([@ydah][])
11
+
5
12
  ## 2.13.1 (2022-09-12)
6
13
 
7
14
  * Include config/obsoletion.yml in the gemspec. ([@hosamaly][])
@@ -76,8 +76,15 @@ module RuboCop
76
76
  end
77
77
 
78
78
  def offense_range(node)
79
- range_between(node.loc.selector.begin_pos,
80
- node.loc.end.end_pos)
79
+ range_between(node.loc.selector.begin_pos, end_pos(node))
80
+ end
81
+
82
+ def end_pos(node)
83
+ if node.loc.end
84
+ node.loc.end.end_pos
85
+ else
86
+ node.loc.expression.end_pos
87
+ end
81
88
  end
82
89
  end
83
90
  end
@@ -29,20 +29,20 @@ module RuboCop
29
29
  class VisibilityMatcher < Base
30
30
  MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
31
31
  MSG_TRUE = 'Use `:visible` instead of `true`.'
32
- CAPYBARA_MATCHER_METHODS = %i[
33
- have_selector
34
- have_css
35
- have_xpath
36
- have_link
37
- have_button
38
- have_field
39
- have_select
40
- have_table
41
- have_checked_field
42
- have_unchecked_field
43
- have_text
44
- have_content
45
- ].freeze
32
+ CAPYBARA_MATCHER_METHODS = %w[
33
+ button
34
+ checked_field
35
+ css
36
+ field
37
+ link
38
+ select
39
+ selector
40
+ table
41
+ unchecked_field
42
+ xpath
43
+ ].flat_map do |element|
44
+ ["have_#{element}".to_sym, "have_no_#{element}".to_sym]
45
+ end
46
46
 
47
47
  RESTRICT_ON_SEND = CAPYBARA_MATCHER_METHODS
48
48
 
@@ -49,10 +49,18 @@ module RuboCop
49
49
  send_pattern('#Expectations.all')
50
50
  )
51
51
 
52
+ # @!method including_any_skip_example?(node)
53
+ # @param [RuboCop::AST::Node] node
54
+ # @return [Boolean]
55
+ def_node_search :including_any_skip_example?, <<~PATTERN
56
+ (send nil? {:pending :skip} ...)
57
+ PATTERN
58
+
52
59
  # @param [RuboCop::AST::BlockNode] node
53
60
  def on_block(node)
54
61
  return unless regular_or_focused_example?(node)
55
62
  return if including_any_expectation?(node)
63
+ return if including_any_skip_example?(node)
56
64
 
57
65
  add_offense(node)
58
66
  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.13.1'
7
+ STRING = '2.13.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.13.1
4
+ version: 2.13.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: 2022-09-12 00:00:00.000000000 Z
13
+ date: 2022-09-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop