rubocop-rspec_rails 2.28.1 → 2.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 587b169f8af3fab4b25bd367cfc9fe3deffcbee837ca9c49fa6742795f19ef48
4
- data.tar.gz: 3b6e3fe95ea4d76bb08528e1fe28bded0436fe1b1173e635bc36c0c5b33abbd0
3
+ metadata.gz: bb6fd80f5adfc6edb60fb77ecfa69b4aeba6b7a1011d30c70a1e6fee6bb2d417
4
+ data.tar.gz: 6cc5cd4b185823f7fa4f114f3d4b911789d997774c40207132d4ba1d6ab7ce01
5
5
  SHA512:
6
- metadata.gz: 932cdb891ef272752fb4bf842eb5f03e9a23e2cf314a0d30024c41ec9de6781cd412699dd6afbf7c514e55f8f47571e58c5ce5f3d4e2f424e15a928e55af77a2
7
- data.tar.gz: 6dce99442ffcbbd9c83eb0ad6650e1427be723d32213c1945e86231ac79b1ad5a63e3b373b31f0e20604ff26860a2342305bf499532f82df6d0822b28a8e1dbc
6
+ metadata.gz: 30246a5475ac1ebf858bf1f0765c01a5e6d740fd70fe23b09f5c45ab87dfe673d2983a8826569d0cc9dc678e4be1e52ac2da704cd4f6e950689e862aa6862e5b
7
+ data.tar.gz: 1ba553cf7599cb25c86435f2d50fdb2d005703d855e568fc4fb3b9ef843679ef5f7477a95d37b96573884958a0a2196c36b97b317c8faec96f9db4a0e313abf5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 2.28.3 (2024-04-11)
6
+
7
+ - Fix an error for Ambiguous cop name `RSpec/Rails/HttpStatus`. ([@ydah])
8
+
9
+ ## 2.28.2 (2024-03-31)
10
+
11
+ - Fix a `NameError` by Cross-Referencing. ([@ydah])
12
+ - Fix an error for `RSpecRails/HttpStatus` when no rack gem is loaded with rubocop-rspec. ([@ydah])
13
+ - Fix an error for unrecognized cop or department `RSpecRails/HttpStatus` when also using rubocop-rails. ([@ydah])
14
+
5
15
  ## 2.28.1 (2024-03-29)
6
16
 
7
17
  - Implicit dependency on RuboCop RSpec. Note that if you use rubocop-rspec_rails, you must also explicitly add rubocop-rspec to the Gemfile, because you are changing to an implicit dependency on RuboCop RSpec. ([@ydah])
@@ -16,7 +16,7 @@ module RuboCop
16
16
  # allow(foo).to receive(:bar)
17
17
  # end
18
18
  #
19
- class AvoidSetupHook < ::RuboCop::Cop::RSpec::Base
19
+ class AvoidSetupHook < ::RuboCop::Cop::Base
20
20
  extend AutoCorrector
21
21
 
22
22
  MSG = 'Use `before` instead of `setup`.'
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rack/utils'
3
+ begin
4
+ require 'rack/utils'
5
+ rescue LoadError
6
+ # RSpecRails/HttpStatus cannot be loaded if rack/utils is unavailable.
7
+ end
4
8
 
5
9
  module RuboCop
6
10
  module Cop
@@ -53,7 +57,7 @@ module RuboCop
53
57
  # it { is_expected.to have_http_status :success }
54
58
  # it { is_expected.to have_http_status :error }
55
59
  #
56
- class HttpStatus < ::RuboCop::Cop::RSpec::Base
60
+ class HttpStatus < ::RuboCop::Cop::Base
57
61
  extend AutoCorrector
58
62
  include ConfigurableEnforcedStyle
59
63
  RESTRICT_ON_SEND = %i[have_http_status].freeze
@@ -64,6 +68,8 @@ module RuboCop
64
68
  PATTERN
65
69
 
66
70
  def on_send(node)
71
+ return unless defined?(::Rack::Utils::SYMBOL_TO_STATUS_CODE)
72
+
67
73
  http_status(node) do |arg|
68
74
  return if arg.str_type? && arg.heredoc?
69
75
 
@@ -29,7 +29,7 @@ module RuboCop
29
29
  # expect(a).to be(true)
30
30
  # expect(a).to be(false)
31
31
  #
32
- class MinitestAssertions < ::RuboCop::Cop::RSpec::Base
32
+ class MinitestAssertions < ::RuboCop::Cop::Base
33
33
  extend AutoCorrector
34
34
 
35
35
  # :nodoc:
@@ -29,7 +29,7 @@ module RuboCop
29
29
  # # good (with method chain)
30
30
  # expect(foo).to be_invalid.or be_even
31
31
  #
32
- class NegationBeValid < ::RuboCop::Cop::RSpec::Base
32
+ class NegationBeValid < ::RuboCop::Cop::Base
33
33
  extend AutoCorrector
34
34
  include ConfigurableEnforcedStyle
35
35
 
@@ -23,7 +23,7 @@ module RuboCop
23
23
  #
24
24
  # # good
25
25
  # before { freeze_time }
26
- class TravelAround < ::RuboCop::Cop::RSpec::Base
26
+ class TravelAround < ::RuboCop::Cop::Base
27
27
  extend AutoCorrector
28
28
 
29
29
  MSG = 'Prefer to travel in `before` rather than `around`.'
@@ -2,12 +2,8 @@
2
2
 
3
3
  require_relative 'rspec_rails/avoid_setup_hook'
4
4
  require_relative 'rspec_rails/have_http_status'
5
- require_relative 'rspec_rails/negation_be_valid'
6
- begin
7
- require_relative 'rspec_rails/http_status'
8
- rescue LoadError
9
- # RSpecRails/HttpStatus cannot be loaded if rack/utils is unavailable.
10
- end
5
+ require_relative 'rspec_rails/http_status'
11
6
  require_relative 'rspec_rails/inferred_spec_type'
12
7
  require_relative 'rspec_rails/minitest_assertions'
8
+ require_relative 'rspec_rails/negation_be_valid'
13
9
  require_relative 'rspec_rails/travel_around'
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpecRails
5
5
  # Version information for the RSpec Rails RuboCop plugin.
6
6
  module Version
7
- STRING = '2.28.1'
7
+ STRING = '2.28.3'
8
8
  end
9
9
  end
10
10
  end
@@ -4,11 +4,32 @@ require 'pathname'
4
4
  require 'yaml'
5
5
 
6
6
  require 'rubocop'
7
- require 'rubocop-rspec'
7
+
8
+ require 'rubocop/rspec/language/node_pattern'
9
+
10
+ require 'rubocop/rspec/language'
8
11
 
9
12
  require_relative 'rubocop/rspec_rails/version'
10
13
 
14
+ require 'rubocop/cop/rspec/base'
11
15
  require_relative 'rubocop/cop/rspec_rails_cops'
12
16
 
13
17
  project_root = File.join(__dir__, '..')
14
18
  RuboCop::ConfigLoader.inject_defaults!(project_root)
19
+
20
+ # FIXME: This is a workaround for the following issue:
21
+ # https://github.com/rubocop/rubocop-rspec_rails/issues/8
22
+ module RuboCop
23
+ module Cop
24
+ class Registry # rubocop:disable Style/Documentation
25
+ prepend(Module.new do
26
+ def qualified_cop_name(name, path, warn: true)
27
+ return super unless name == 'RSpec/Rails/HttpStatus'
28
+
29
+ badge = Badge.parse(name)
30
+ resolve_badge(badge, qualify_badge(badge).first, path)
31
+ end
32
+ end)
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.28.1
4
+ version: 2.28.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Quorning
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-03-28 00:00:00.000000000 Z
14
+ date: 2024-04-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rubocop
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.5.7
79
+ rubygems_version: 3.5.3
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Code style checking for RSpec Rails files