rubocop-rspec 1.30.0 → 1.30.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rubocop/cop/rspec/example_wording.rb +2 -2
- data/lib/rubocop/cop/rspec/factory_bot/create_list.rb +3 -2
- data/lib/rubocop/rspec/config_formatter.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- data/lib/rubocop/rspec/wording.rb +4 -4
- data/rubocop-rspec.gemspec +1 -1
- data/spec/rubocop/cop/rspec/factory_bot/create_list_spec.rb +2 -3
- data/spec/rubocop/cop/rspec/multiple_expectations_spec.rb +1 -1
- data/spec/rubocop/cop/rspec/nested_groups_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89853728f31f151cfe129bc754317563747529c95f5298be06478247b0a91bf0
|
4
|
+
data.tar.gz: 18a0909fe1352450cd69e289323e3c06f69a38cfb15fb54b3bc79b4f22c089d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d75b3a00d3da18979fd4a9effd3a8b231b54267695998cb8f61a57c0cae64121dc3d5d740422a8283abf425adee11ea4f6aff9d5247d9e8785971a52d949f6c0
|
7
|
+
data.tar.gz: feedb0ccb5ddc363c7c71fdaf4647316be0a9dc3063079621188fb2fa81b6e3165a1bc0b7ce7850342a10e216bf355ec5df682bcce7a957c40f2ee794394a64e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Master (Unreleased)
|
4
4
|
|
5
|
+
## 1.30.1 (2018-11-01)
|
6
|
+
|
7
|
+
* `FactoryBot/CreateList` now ignores `times` blocks with an argument. ([@Darhazer][])
|
8
|
+
|
5
9
|
## 1.30.0 (2018-10-08)
|
6
10
|
|
7
11
|
* Add config to `RSpec/VerifiedDoubles` to enforcement of verification on unnamed doubles. ([@BrentWheeldon][])
|
@@ -33,8 +33,8 @@ module RuboCop
|
|
33
33
|
MSG_SHOULD = 'Do not use should when describing your tests.'.freeze
|
34
34
|
MSG_IT = "Do not repeat 'it' when describing your tests.".freeze
|
35
35
|
|
36
|
-
SHOULD_PREFIX = /\Ashould(?:n't)?\b/i
|
37
|
-
IT_PREFIX = /\Ait /i
|
36
|
+
SHOULD_PREFIX = /\Ashould(?:n't)?\b/i.freeze
|
37
|
+
IT_PREFIX = /\Ait /i.freeze
|
38
38
|
|
39
39
|
def_node_matcher(
|
40
40
|
:it_description,
|
@@ -30,9 +30,10 @@ module RuboCop
|
|
30
30
|
MSG_CREATE_LIST = 'Prefer create_list.'.freeze
|
31
31
|
MSG_N_TIMES = 'Prefer %<number>s.times.'.freeze
|
32
32
|
|
33
|
-
def_node_matcher :
|
33
|
+
def_node_matcher :n_times_block_without_arg?, <<-PATTERN
|
34
34
|
(block
|
35
35
|
(send (int _) :times)
|
36
|
+
(args)
|
36
37
|
...
|
37
38
|
)
|
38
39
|
PATTERN
|
@@ -47,7 +48,7 @@ module RuboCop
|
|
47
48
|
|
48
49
|
def on_block(node)
|
49
50
|
return unless style == :create_list
|
50
|
-
return unless
|
51
|
+
return unless n_times_block_without_arg?(node)
|
51
52
|
return unless contains_only_factory?(node.body)
|
52
53
|
|
53
54
|
add_offense(node.send_node,
|
@@ -4,7 +4,7 @@ module RuboCop
|
|
4
4
|
module RSpec
|
5
5
|
# Builds a YAML config file from two config hashes
|
6
6
|
class ConfigFormatter
|
7
|
-
NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)
|
7
|
+
NAMESPACES = /^(RSpec|Capybara|FactoryBot|Rails)/.freeze
|
8
8
|
STYLE_GUIDE_BASE_URL = 'http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'.freeze
|
9
9
|
|
10
10
|
def initialize(config, descriptions)
|
@@ -4,10 +4,10 @@ module RuboCop
|
|
4
4
|
module RSpec
|
5
5
|
# RSpec example wording rewriter
|
6
6
|
class Wording
|
7
|
-
SHOULDNT_PREFIX = /\Ashould(?:n't| not)\b/i
|
8
|
-
SHOULDNT_BE_PREFIX = /#{SHOULDNT_PREFIX} be\b/i
|
9
|
-
ES_SUFFIX_PATTERN = /(?:o|s|x|ch|sh|z)\z/i
|
10
|
-
IES_SUFFIX_PATTERN = /[^aeou]y\z/i
|
7
|
+
SHOULDNT_PREFIX = /\Ashould(?:n't| not)\b/i.freeze
|
8
|
+
SHOULDNT_BE_PREFIX = /#{SHOULDNT_PREFIX} be\b/i.freeze
|
9
|
+
ES_SUFFIX_PATTERN = /(?:o|s|x|ch|sh|z)\z/i.freeze
|
10
|
+
IES_SUFFIX_PATTERN = /[^aeou]y\z/i.freeze
|
11
11
|
|
12
12
|
def initialize(text, ignore:, replace:)
|
13
13
|
@text = text
|
data/rubocop-rspec.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
'documentation_uri' => 'https://rubocop-rspec.readthedocs.io/'
|
38
38
|
}
|
39
39
|
|
40
|
-
spec.add_runtime_dependency 'rubocop', '>= 0.
|
40
|
+
spec.add_runtime_dependency 'rubocop', '>= 0.60.0'
|
41
41
|
|
42
42
|
spec.add_development_dependency 'rack'
|
43
43
|
spec.add_development_dependency 'rake'
|
@@ -41,10 +41,9 @@ RSpec.describe RuboCop::Cop::RSpec::FactoryBot::CreateList, :config do
|
|
41
41
|
RUBY
|
42
42
|
end
|
43
43
|
|
44
|
-
it '
|
45
|
-
|
44
|
+
it 'ignores n.times with argument' do
|
45
|
+
expect_no_offenses(<<-RUBY)
|
46
46
|
3.times { |n| create :user, created_at: n.days.ago }
|
47
|
-
^^^^^^^ Prefer create_list.
|
48
47
|
RUBY
|
49
48
|
end
|
50
49
|
|
@@ -34,7 +34,7 @@ RSpec.describe RuboCop::Cop::RSpec::NestedGroups, :config do
|
|
34
34
|
end
|
35
35
|
RUBY
|
36
36
|
|
37
|
-
expect(cop.config_to_allow_offenses).to eq('Max' => 4)
|
37
|
+
expect(cop.config_to_allow_offenses[:exclude_limit]).to eq('Max' => 4)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'ignores non-spec context methods' do
|
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.30.
|
4
|
+
version: 1.30.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-
|
13
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.60.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.60.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rack
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|