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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a59e8fa42b2cb3434cc923508e5fb7fb23959eea5912588425575216966173c
4
- data.tar.gz: e0a0419763273fba02709cd92c1c86c6704398e24947d29d9499df29cf60efec
3
+ metadata.gz: 89853728f31f151cfe129bc754317563747529c95f5298be06478247b0a91bf0
4
+ data.tar.gz: 18a0909fe1352450cd69e289323e3c06f69a38cfb15fb54b3bc79b4f22c089d0
5
5
  SHA512:
6
- metadata.gz: 9bc9fa634cc51edc446f4ea65f8590fedafbcb754b5667383aa3f0b71cc5a8aaff114f40d093d261a43b642efdb23f8ac2a39047fab2b9104c768362ab0c2569
7
- data.tar.gz: b5c52f755b673b2f0fd1a3075a1b1a61060f4216f2b1548a24e4622da5a93f9ada94c39d4abc9644d92bae22cd5019c89693a3d1d6cd32952c748dbfdf8b554f
6
+ metadata.gz: d75b3a00d3da18979fd4a9effd3a8b231b54267695998cb8f61a57c0cae64121dc3d5d740422a8283abf425adee11ea4f6aff9d5247d9e8785971a52d949f6c0
7
+ data.tar.gz: feedb0ccb5ddc363c7c71fdaf4647316be0a9dc3063079621188fb2fa81b6e3165a1bc0b7ce7850342a10e216bf355ec5df682bcce7a957c40f2ee794394a64e
@@ -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 :n_times_block?, <<-PATTERN
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 n_times_block?(node)
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,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.30.0'.freeze
7
+ STRING = '1.30.1'.freeze
8
8
  end
9
9
  end
10
10
  end
@@ -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
@@ -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.58.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 'flags n.times with argument' do
45
- expect_offense(<<-RUBY)
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
 
@@ -229,6 +229,6 @@ RSpec.describe RuboCop::Cop::RSpec::MultipleExpectations, :config do
229
229
  end
230
230
  RUBY
231
231
 
232
- expect(cop.config_to_allow_offenses).to eq('Max' => 3)
232
+ expect(cop.config_to_allow_offenses[:exclude_limit]).to eq('Max' => 3)
233
233
  end
234
234
  end
@@ -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.0
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-10-08 00:00:00.000000000 Z
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.58.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.58.0
28
+ version: 0.60.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rack
31
31
  requirement: !ruby/object:Gem::Requirement