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:
 | 
			
		||||
        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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
  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)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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(' ')}",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue