diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7abf15a8..9f6292c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: matrix: ruby: - 3.1.2 - - 3.0.3 - - 2.7.5 - - 2.6.9 + - 3.0.4 + - 2.7.6 + - 2.6.10 appraisal: - rails_7_0 - rails_6_1 @@ -41,10 +41,10 @@ jobs: - postgresql exclude: - { ruby: 3.1.2, appraisal: rails_5_2 } - - { ruby: 3.0.3, appraisal: rails_5_2 } - - { ruby: 3.0.3, appraisal: rails_7_0 } - - { ruby: 2.7.5, appraisal: rails_7_0 } - - { ruby: 2.6.9, appraisal: rails_7_0 } + - { ruby: 3.0.4, appraisal: rails_5_2 } + - { ruby: 3.0.4, appraisal: rails_7_0 } + - { ruby: 2.7.6, appraisal: rails_7_0 } + - { ruby: 2.6.10, appraisal: rails_7_0 } env: DATABASE_ADAPTER: ${{ matrix.adapter }} BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile diff --git a/.rubocop.yml b/.rubocop.yml index 173e6376..add6007a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -30,7 +30,7 @@ Layout/LineLength: - '^[ ]*#.+$' - '^[ ]*''.+?'' => ''.+?'',?$' - '^[ ]*".+?" => ".+?",?$' - Max: 80 + Max: 100 Layout/MultilineMethodCallIndentation: EnforcedStyle: indented Layout/ParameterAlignment: @@ -104,6 +104,8 @@ Naming/MemoizedInstanceVariableName: EnforcedStyleForLeadingUnderscores: required Naming/PredicateName: Enabled: false +Naming/VariableNumber: + Enabled: false Naming/RescuedExceptionsVariableName: Enabled: false Rails/Date: diff --git a/.ruby-version b/.ruby-version index 75a22a26..ef538c28 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.3 +3.1.2 diff --git a/.tool-versions b/.tool-versions index 38ec1517..0b2d8587 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 3.0.3 +ruby 3.1.2 diff --git a/Gemfile.lock b/Gemfile.lock index dbc61a98..61ee4178 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,28 +1,28 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.3.4) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) - ast (2.4.1) + ast (2.4.2) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.10) diff-lcs (1.3) fssm (0.2.10) - i18n (1.8.5) + i18n (1.12.0) concurrent-ruby (~> 1.0) + json (2.6.2) method_source (1.0.0) - minitest (5.15.0) - parallel (1.19.2) - parser (2.7.2.0) + minitest (5.16.3) + parallel (1.22.1) + parser (3.1.2.1) ast (~> 2.4.1) pry (0.13.1) coderay (~> 1.1) @@ -30,12 +30,12 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - rack (2.2.3) - rainbow (3.0.0) + rack (3.0.0) + rainbow (3.1.1) rake (13.0.1) redcarpet (3.5.0) - regexp_parser (1.8.2) - rexml (3.2.4) + regexp_parser (2.5.0) + rexml (3.2.5) rouge (3.22.0) rspec (3.9.0) rspec-core (~> 3.9.0) @@ -50,32 +50,31 @@ GEM diff-lcs (>= 1.2.0, < 2.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) - parser (>= 2.7.1.5) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.20.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.1.0) - parser (>= 2.7.1.5) - rubocop-packaging (0.5.1) - rubocop (>= 0.89, < 2.0) - rubocop-rails (2.8.1) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.21.0) + parser (>= 3.1.1.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-rails (2.16.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.87.0) - ruby-progressbar (1.10.1) + rubocop (>= 1.33.0, < 2.0) + ruby-progressbar (1.11.0) thor (0.20.0) - thread_safe (0.3.6) - tzinfo (1.2.7) - thread_safe (~> 0.1) - unicode-display_width (1.7.0) + tzinfo (2.0.5) + concurrent-ruby (~> 1.0) + unicode-display_width (2.3.0) warnings_logger (0.1.1) yard (0.9.25) - zeitwerk (2.4.0) zeus (0.15.14) method_source (>= 0.6.7) diff --git a/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb b/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb index 33f5defc..055829f5 100644 --- a/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +++ b/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb @@ -55,11 +55,9 @@ module Shoulda private def disallow_value_matcher - @_disallow_value_matcher ||= begin - DisallowValueMatcher.new(disallowed_value).tap do |matcher| - matcher.for(attribute) - wrap_disallow_value_matcher(matcher) - end + @_disallow_value_matcher ||= DisallowValueMatcher.new(disallowed_value).tap do |matcher| + matcher.for(attribute) + wrap_disallow_value_matcher(matcher) end end end diff --git a/lib/shoulda/matchers/util/word_wrap.rb b/lib/shoulda/matchers/util/word_wrap.rb index f51e5cce..664b619f 100644 --- a/lib/shoulda/matchers/util/word_wrap.rb +++ b/lib/shoulda/matchers/util/word_wrap.rb @@ -92,7 +92,7 @@ module Shoulda if line.list_item? combined_lines << line else - combined_lines.last << (" #{line}").squeeze(' ') + combined_lines.last << " #{line}".squeeze(' ') end combined_lines diff --git a/spec/support/unit/model_creation_strategies/active_model.rb b/spec/support/unit/model_creation_strategies/active_model.rb index 163356a9..dda3e470 100644 --- a/spec/support/unit/model_creation_strategies/active_model.rb +++ b/spec/support/unit/model_creation_strategies/active_model.rb @@ -104,7 +104,7 @@ module UnitTests end def inspect - middle = '%s:0x%014x%s' % [ # rubocop:disable Style/FormatStringToken + middle = '%s:0x%014x%s' % [ self.class, object_id * 2, " #{inspected_attributes.join(' ')}", diff --git a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb index 626728c4..8fac6173 100644 --- a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb @@ -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 define_model :child - define_model :conception, child_id: :integer, - parent_id: :integer do + define_model :conception, child_id: :integer, parent_id: :integer do belongs_to :child 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 define_model :detail, detailable_id: :integer, - detailable_type: :string + detailable_type: :string define_model :person do has_one :detail, as: :detailable 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 define_model :detail, detailable_id: :integer, - detailable_type: :string + detailable_type: :string define_model :person do has_one :detail, as: :describable end @@ -1524,7 +1523,7 @@ Expected Parent to have a has_many association called children through conceptio define_model :relative define_model :person 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) 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) end 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) end @@ -1991,7 +1990,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives ( has_and_belongs_to_many :relatives end 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) end @@ -2008,7 +2007,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives ( end 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') 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 end 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) end @@ -2091,7 +2090,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives ( has_and_belongs_to_many :relatives end 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)' 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 = {}) define_model :relative define_model :people_relative, id: false, person_id: :integer, - relative_id: :integer + relative_id: :integer define_model :person do has_and_belongs_to_many :relatives end.new