mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Update Ruby to the latest version (#1509)
* Update ruby to the latest version * Bump Rubocop to 1.36.0 * Fix "Style/RedundantBegin: Redundant begin block detected" rubocop offense * Disable Naming/VariableNumber offense * Fix "Style/RedundantParentheses: Don't use parentheses around a literal" rubocop offense * Fix "Lint/RedundantCopDisableDirective: Unnecessary disabling of Style/FormatStringToken." rubocop offense * Fix "Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call" rubocop offense * Bump Ruby to 3.1.2 * Bump rubocop-rails to 2.16.1 * Bump rubocop-packaging to 0.5.2
This commit is contained in:
parent
8a701024bd
commit
958a9fec66
9 changed files with 59 additions and 61 deletions
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
|
@ -28,9 +28,9 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
ruby:
|
ruby:
|
||||||
- 3.1.2
|
- 3.1.2
|
||||||
- 3.0.3
|
- 3.0.4
|
||||||
- 2.7.5
|
- 2.7.6
|
||||||
- 2.6.9
|
- 2.6.10
|
||||||
appraisal:
|
appraisal:
|
||||||
- rails_7_0
|
- rails_7_0
|
||||||
- rails_6_1
|
- rails_6_1
|
||||||
|
@ -41,10 +41,10 @@ jobs:
|
||||||
- postgresql
|
- postgresql
|
||||||
exclude:
|
exclude:
|
||||||
- { ruby: 3.1.2, appraisal: rails_5_2 }
|
- { ruby: 3.1.2, appraisal: rails_5_2 }
|
||||||
- { ruby: 3.0.3, appraisal: rails_5_2 }
|
- { ruby: 3.0.4, appraisal: rails_5_2 }
|
||||||
- { ruby: 3.0.3, appraisal: rails_7_0 }
|
- { ruby: 3.0.4, appraisal: rails_7_0 }
|
||||||
- { ruby: 2.7.5, appraisal: rails_7_0 }
|
- { ruby: 2.7.6, appraisal: rails_7_0 }
|
||||||
- { ruby: 2.6.9, appraisal: rails_7_0 }
|
- { ruby: 2.6.10, appraisal: rails_7_0 }
|
||||||
env:
|
env:
|
||||||
DATABASE_ADAPTER: ${{ matrix.adapter }}
|
DATABASE_ADAPTER: ${{ matrix.adapter }}
|
||||||
BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile
|
||||||
|
|
|
@ -30,7 +30,7 @@ Layout/LineLength:
|
||||||
- '^[ ]*#.+$'
|
- '^[ ]*#.+$'
|
||||||
- '^[ ]*''.+?'' => ''.+?'',?$'
|
- '^[ ]*''.+?'' => ''.+?'',?$'
|
||||||
- '^[ ]*".+?" => ".+?",?$'
|
- '^[ ]*".+?" => ".+?",?$'
|
||||||
Max: 80
|
Max: 100
|
||||||
Layout/MultilineMethodCallIndentation:
|
Layout/MultilineMethodCallIndentation:
|
||||||
EnforcedStyle: indented
|
EnforcedStyle: indented
|
||||||
Layout/ParameterAlignment:
|
Layout/ParameterAlignment:
|
||||||
|
@ -104,6 +104,8 @@ Naming/MemoizedInstanceVariableName:
|
||||||
EnforcedStyleForLeadingUnderscores: required
|
EnforcedStyleForLeadingUnderscores: required
|
||||||
Naming/PredicateName:
|
Naming/PredicateName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Naming/VariableNumber:
|
||||||
|
Enabled: false
|
||||||
Naming/RescuedExceptionsVariableName:
|
Naming/RescuedExceptionsVariableName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3.0.3
|
3.1.2
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ruby 3.0.3
|
ruby 3.1.2
|
||||||
|
|
65
Gemfile.lock
65
Gemfile.lock
|
@ -1,28 +1,28 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
activesupport (6.0.3.4)
|
activesupport (7.0.4)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 2.0)
|
||||||
zeitwerk (~> 2.2, >= 2.2.2)
|
|
||||||
appraisal (2.2.0)
|
appraisal (2.2.0)
|
||||||
bundler
|
bundler
|
||||||
rake
|
rake
|
||||||
thor (>= 0.14.0)
|
thor (>= 0.14.0)
|
||||||
ast (2.4.1)
|
ast (2.4.2)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.1.7)
|
concurrent-ruby (1.1.10)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
fssm (0.2.10)
|
fssm (0.2.10)
|
||||||
i18n (1.8.5)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
json (2.6.2)
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
minitest (5.15.0)
|
minitest (5.16.3)
|
||||||
parallel (1.19.2)
|
parallel (1.22.1)
|
||||||
parser (2.7.2.0)
|
parser (3.1.2.1)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
pry (0.13.1)
|
pry (0.13.1)
|
||||||
coderay (~> 1.1)
|
coderay (~> 1.1)
|
||||||
|
@ -30,12 +30,12 @@ GEM
|
||||||
pry-byebug (3.9.0)
|
pry-byebug (3.9.0)
|
||||||
byebug (~> 11.0)
|
byebug (~> 11.0)
|
||||||
pry (~> 0.13.0)
|
pry (~> 0.13.0)
|
||||||
rack (2.2.3)
|
rack (3.0.0)
|
||||||
rainbow (3.0.0)
|
rainbow (3.1.1)
|
||||||
rake (13.0.1)
|
rake (13.0.1)
|
||||||
redcarpet (3.5.0)
|
redcarpet (3.5.0)
|
||||||
regexp_parser (1.8.2)
|
regexp_parser (2.5.0)
|
||||||
rexml (3.2.4)
|
rexml (3.2.5)
|
||||||
rouge (3.22.0)
|
rouge (3.22.0)
|
||||||
rspec (3.9.0)
|
rspec (3.9.0)
|
||||||
rspec-core (~> 3.9.0)
|
rspec-core (~> 3.9.0)
|
||||||
|
@ -50,32 +50,31 @@ GEM
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-support (3.9.0)
|
rspec-support (3.9.0)
|
||||||
rubocop (1.0.0)
|
rubocop (1.36.0)
|
||||||
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 3.1.2.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml
|
rexml (>= 3.2.5, < 4.0)
|
||||||
rubocop-ast (>= 0.6.0)
|
rubocop-ast (>= 1.20.1, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 2.0)
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
rubocop-ast (1.1.0)
|
rubocop-ast (1.21.0)
|
||||||
parser (>= 2.7.1.5)
|
parser (>= 3.1.1.0)
|
||||||
rubocop-packaging (0.5.1)
|
rubocop-packaging (0.5.2)
|
||||||
rubocop (>= 0.89, < 2.0)
|
rubocop (>= 1.33, < 2.0)
|
||||||
rubocop-rails (2.8.1)
|
rubocop-rails (2.16.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.87.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
ruby-progressbar (1.10.1)
|
ruby-progressbar (1.11.0)
|
||||||
thor (0.20.0)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
tzinfo (2.0.5)
|
||||||
tzinfo (1.2.7)
|
concurrent-ruby (~> 1.0)
|
||||||
thread_safe (~> 0.1)
|
unicode-display_width (2.3.0)
|
||||||
unicode-display_width (1.7.0)
|
|
||||||
warnings_logger (0.1.1)
|
warnings_logger (0.1.1)
|
||||||
yard (0.9.25)
|
yard (0.9.25)
|
||||||
zeitwerk (2.4.0)
|
|
||||||
zeus (0.15.14)
|
zeus (0.15.14)
|
||||||
method_source (>= 0.6.7)
|
method_source (>= 0.6.7)
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,9 @@ module Shoulda
|
||||||
private
|
private
|
||||||
|
|
||||||
def disallow_value_matcher
|
def disallow_value_matcher
|
||||||
@_disallow_value_matcher ||= begin
|
@_disallow_value_matcher ||= DisallowValueMatcher.new(disallowed_value).tap do |matcher|
|
||||||
DisallowValueMatcher.new(disallowed_value).tap do |matcher|
|
matcher.for(attribute)
|
||||||
matcher.for(attribute)
|
wrap_disallow_value_matcher(matcher)
|
||||||
wrap_disallow_value_matcher(matcher)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -92,7 +92,7 @@ module Shoulda
|
||||||
if line.list_item?
|
if line.list_item?
|
||||||
combined_lines << line
|
combined_lines << line
|
||||||
else
|
else
|
||||||
combined_lines.last << (" #{line}").squeeze(' ')
|
combined_lines.last << " #{line}".squeeze(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
combined_lines
|
combined_lines
|
||||||
|
|
|
@ -104,7 +104,7 @@ module UnitTests
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
middle = '%s:0x%014x%s' % [ # rubocop:disable Style/FormatStringToken
|
middle = '%s:0x%014x%s' % [
|
||||||
self.class,
|
self.class,
|
||||||
object_id * 2,
|
object_id * 2,
|
||||||
" #{inspected_attributes.join(' ')}",
|
" #{inspected_attributes.join(' ')}",
|
||||||
|
|
|
@ -845,8 +845,7 @@ Expected Parent to have a has_many association called children through conceptio
|
||||||
it 'rejects an association that has the wrong :through option' do
|
it 'rejects an association that has the wrong :through option' do
|
||||||
define_model :child
|
define_model :child
|
||||||
|
|
||||||
define_model :conception, child_id: :integer,
|
define_model :conception, child_id: :integer, parent_id: :integer do
|
||||||
parent_id: :integer do
|
|
||||||
belongs_to :child
|
belongs_to :child
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1183,7 +1182,7 @@ Expected Parent to have a has_many association called children through conceptio
|
||||||
|
|
||||||
it 'accepts a valid association with an :as option' do
|
it 'accepts a valid association with an :as option' do
|
||||||
define_model :detail, detailable_id: :integer,
|
define_model :detail, detailable_id: :integer,
|
||||||
detailable_type: :string
|
detailable_type: :string
|
||||||
define_model :person do
|
define_model :person do
|
||||||
has_one :detail, as: :detailable
|
has_one :detail, as: :detailable
|
||||||
end
|
end
|
||||||
|
@ -1226,7 +1225,7 @@ Expected Parent to have a has_many association called children through conceptio
|
||||||
|
|
||||||
it 'rejects an association with a bad :as option' do
|
it 'rejects an association with a bad :as option' do
|
||||||
define_model :detail, detailable_id: :integer,
|
define_model :detail, detailable_id: :integer,
|
||||||
detailable_type: :string
|
detailable_type: :string
|
||||||
define_model :person do
|
define_model :person do
|
||||||
has_one :detail, as: :describable
|
has_one :detail, as: :describable
|
||||||
end
|
end
|
||||||
|
@ -1524,7 +1523,7 @@ Expected Parent to have a has_many association called children through conceptio
|
||||||
define_model :relative
|
define_model :relative
|
||||||
define_model :person
|
define_model :person
|
||||||
define_model :people_relative, id: false, person_id: :integer,
|
define_model :people_relative, id: false, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
|
|
||||||
expect(Person.new).not_to have_and_belong_to_many(:relatives)
|
expect(Person.new).not_to have_and_belong_to_many(:relatives)
|
||||||
end
|
end
|
||||||
|
@ -1980,7 +1979,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
define_association_with_conditions(model, :has_and_belongs_to_many, :relatives, adopted: true)
|
define_association_with_conditions(model, :has_and_belongs_to_many, :relatives, adopted: true)
|
||||||
end
|
end
|
||||||
define_model :people_relative, id: false, person_id: :integer,
|
define_model :people_relative, id: false, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
|
|
||||||
expect(Person.new).to have_and_belong_to_many(:relatives).conditions(adopted: true)
|
expect(Person.new).to have_and_belong_to_many(:relatives).conditions(adopted: true)
|
||||||
end
|
end
|
||||||
|
@ -1991,7 +1990,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
has_and_belongs_to_many :relatives
|
has_and_belongs_to_many :relatives
|
||||||
end
|
end
|
||||||
define_model :people_relative, id: false, person_id: :integer,
|
define_model :people_relative, id: false, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
|
|
||||||
expect(Person.new).not_to have_and_belong_to_many(:relatives).conditions(adopted: true)
|
expect(Person.new).not_to have_and_belong_to_many(:relatives).conditions(adopted: true)
|
||||||
end
|
end
|
||||||
|
@ -2008,7 +2007,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
end
|
end
|
||||||
|
|
||||||
define_model :people_person_relative, person_id: :integer,
|
define_model :people_person_relative, person_id: :integer,
|
||||||
person_relative_id: :integer
|
person_relative_id: :integer
|
||||||
|
|
||||||
expect(Person.new).to have_and_belong_to_many(:relatives).class_name('PersonRelative')
|
expect(Person.new).to have_and_belong_to_many(:relatives).class_name('PersonRelative')
|
||||||
end
|
end
|
||||||
|
@ -2081,7 +2080,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
has_and_belongs_to_many :relatives, autosave: true
|
has_and_belongs_to_many :relatives, autosave: true
|
||||||
end
|
end
|
||||||
define_model :people_relative, person_id: :integer,
|
define_model :people_relative, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
expect(Person.new).to have_and_belong_to_many(:relatives).autosave(true)
|
expect(Person.new).to have_and_belong_to_many(:relatives).autosave(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2091,7 +2090,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
has_and_belongs_to_many :relatives
|
has_and_belongs_to_many :relatives
|
||||||
end
|
end
|
||||||
define_model :people_relative, person_id: :integer,
|
define_model :people_relative, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
|
|
||||||
message = 'Expected Person to have a has_and_belongs_to_many association called relatives (relatives should have autosave set to true)'
|
message = 'Expected Person to have a has_and_belongs_to_many association called relatives (relatives should have autosave set to true)'
|
||||||
expect {
|
expect {
|
||||||
|
@ -2124,7 +2123,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
|
||||||
def having_and_belonging_to_many_relatives(_options = {})
|
def having_and_belonging_to_many_relatives(_options = {})
|
||||||
define_model :relative
|
define_model :relative
|
||||||
define_model :people_relative, id: false, person_id: :integer,
|
define_model :people_relative, id: false, person_id: :integer,
|
||||||
relative_id: :integer
|
relative_id: :integer
|
||||||
define_model :person do
|
define_model :person do
|
||||||
has_and_belongs_to_many :relatives
|
has_and_belongs_to_many :relatives
|
||||||
end.new
|
end.new
|
||||||
|
|
Loading…
Reference in a new issue