mirror of
				https://github.com/thoughtbot/shoulda-matchers.git
				synced 2022-11-09 12:01:38 -05:00 
			
		
		
		
	fix(rubocop): Fix Layout related offenses [ci skip]
- Layout/EmptyLines - Layout/EmptyLineAfterGuardClause - Layout/TrailingEmptyLines - Layout/EmptyLinesAroundBlockBody - Layout/EmptyLinesAroundModuleBody - Layout/EmptyLineAfterMagicComment - Layout/SpaceInsidePercentLiteralDelimiters - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceInsideArrayLiteralBrackets - Layout/LeadingCommentSpace - Layout/SpaceBeforeComment - Layout/SpaceAroundOperators - Layout/SpaceInsideRangeLiteral - Layout/SpaceInsideReferenceBrackets - Layout/SpaceInLambdaLiteral - Layout/SpaceAfterComma - Layout/SpaceInsideHashLiteralBraces - Layout/TrailingWhitespace - Layout/ArgumentAlignment - Layout/HashAlignment - Layout/DotPosition - Layout/IndentationWidth - Layout/EndAlignment - Layout/MultilineOperationIndentation - Layout/IndentationConsistency - Layout/ClosingHeredocIndentation - Layout/MultilineMethodCallBrace- Layout - Layout/ClosingParenthesisIndentation
This commit is contained in:
		
							parent
							
								
									0acc27eaac
								
							
						
					
					
						commit
						ee1008de7a
					
				
					 44 changed files with 98 additions and 101 deletions
				
			
		| 
						 | 
				
			
			@ -15,6 +15,7 @@ def class_list(root = Registry.root, tree = TreeContext.new)
 | 
			
		|||
  end
 | 
			
		||||
  children.compact.sort_by(&:path).each do |child|
 | 
			
		||||
    next unless child.is_a?(CodeObjects::NamespaceObject)
 | 
			
		||||
 | 
			
		||||
    name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name
 | 
			
		||||
    has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
 | 
			
		||||
    out << "<li id='object_#{child.path}' class='#{tree.classes.join(' ')}'>"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -183,7 +183,6 @@ module Shoulda
 | 
			
		|||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        def guess_controller_if_necessary(controller)
 | 
			
		||||
          params[:controller] ||= controller.controller_path
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ module Shoulda
 | 
			
		|||
    module ActionController
 | 
			
		||||
      # @private
 | 
			
		||||
      class RouteParams
 | 
			
		||||
        PARAMS_TO_SYMBOLIZE = %i{ format }
 | 
			
		||||
        PARAMS_TO_SYMBOLIZE = %i{format}
 | 
			
		||||
 | 
			
		||||
        def initialize(args)
 | 
			
		||||
          @args = args
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,8 +94,8 @@ module Shoulda
 | 
			
		|||
              @failure_message_when_negated = 'no attributes were protected'
 | 
			
		||||
            else
 | 
			
		||||
              @failure_message_when_negated = "#{class_name} is protecting " <<
 | 
			
		||||
                "#{protected_attributes.to_a.to_sentence}, " <<
 | 
			
		||||
                "but not #{@attribute}."
 | 
			
		||||
                                              "#{protected_attributes.to_a.to_sentence}, " <<
 | 
			
		||||
                                              "but not #{@attribute}."
 | 
			
		||||
            end
 | 
			
		||||
            true
 | 
			
		||||
          else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ module Shoulda
 | 
			
		|||
          self
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def with_message(message, options={})
 | 
			
		||||
        def with_message(message, options = {})
 | 
			
		||||
          allow_matcher.with_message(message, options)
 | 
			
		||||
          self
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ module Shoulda
 | 
			
		|||
            unless numericality_matcher.respond_to? :diff_to_compare
 | 
			
		||||
              raise ArgumentError, 'numericality_matcher is invalid'
 | 
			
		||||
            end
 | 
			
		||||
 | 
			
		||||
            @numericality_matcher = numericality_matcher
 | 
			
		||||
            @value = value
 | 
			
		||||
            @operator = operator
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +128,7 @@ module Shoulda
 | 
			
		|||
            when :<=
 | 
			
		||||
              [true, true, false]
 | 
			
		||||
            when :!=
 | 
			
		||||
               [true, false, true]
 | 
			
		||||
              [true, false, true]
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ module Shoulda
 | 
			
		|||
          if reflection
 | 
			
		||||
            obj = reflection.klass.new
 | 
			
		||||
            if collection?
 | 
			
		||||
              [ obj ]
 | 
			
		||||
              [obj]
 | 
			
		||||
            else
 | 
			
		||||
              obj
 | 
			
		||||
            end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -545,10 +545,10 @@ EOT
 | 
			
		|||
          values = []
 | 
			
		||||
 | 
			
		||||
          values << case @array
 | 
			
		||||
            when [true]  then false
 | 
			
		||||
            when [false] then true
 | 
			
		||||
            else              raise CouldNotDetermineValueOutsideOfArray
 | 
			
		||||
          end
 | 
			
		||||
                    when [true]  then false
 | 
			
		||||
                    when [false] then true
 | 
			
		||||
                    else              raise CouldNotDetermineValueOutsideOfArray
 | 
			
		||||
                    end
 | 
			
		||||
 | 
			
		||||
          if attribute_allows_nil?
 | 
			
		||||
            values << nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -372,9 +372,9 @@ module Shoulda
 | 
			
		|||
        def allow_nil
 | 
			
		||||
          @expects_to_allow_nil = true
 | 
			
		||||
          prepare_submatcher(
 | 
			
		||||
            AllowValueMatcher.new(nil)
 | 
			
		||||
              .for(@attribute)
 | 
			
		||||
              .with_message(:not_a_number),
 | 
			
		||||
            AllowValueMatcher.new(nil).
 | 
			
		||||
              for(@attribute).
 | 
			
		||||
              with_message(:not_a_number),
 | 
			
		||||
          )
 | 
			
		||||
          self
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ module Shoulda
 | 
			
		|||
      class ValidationMessageFinder
 | 
			
		||||
        include Helpers
 | 
			
		||||
 | 
			
		||||
        def initialize(instance, attribute, context=nil)
 | 
			
		||||
        def initialize(instance, attribute, context = nil)
 | 
			
		||||
          @instance = instance
 | 
			
		||||
          @attribute = attribute
 | 
			
		||||
          @context = context
 | 
			
		||||
| 
						 | 
				
			
			@ -58,8 +58,6 @@ module Shoulda
 | 
			
		|||
          @instance
 | 
			
		||||
        end
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -421,9 +421,9 @@ module Shoulda
 | 
			
		|||
        def expected_prefix
 | 
			
		||||
          if options.include?(:prefix)
 | 
			
		||||
            if options[:prefix] == true
 | 
			
		||||
              attribute_name#.to_sym
 | 
			
		||||
              attribute_name # .to_sym
 | 
			
		||||
            else
 | 
			
		||||
              options[:prefix]#.to_sym
 | 
			
		||||
              options[:prefix] # .to_sym
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			@ -431,9 +431,9 @@ module Shoulda
 | 
			
		|||
        def expected_suffix
 | 
			
		||||
          if options.include?(:suffix)
 | 
			
		||||
            if options[:suffix] == true
 | 
			
		||||
              attribute_name#.to_sym
 | 
			
		||||
              attribute_name # .to_sym
 | 
			
		||||
            else
 | 
			
		||||
              options[:suffix]#.to_sym
 | 
			
		||||
              options[:suffix] # .to_sym
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,11 +40,11 @@ module Shoulda
 | 
			
		|||
          else
 | 
			
		||||
            if readonly_attributes.empty?
 | 
			
		||||
              @failure_message = "#{class_name} attribute #{@attribute} " <<
 | 
			
		||||
                'is not read-only'
 | 
			
		||||
                                 'is not read-only'
 | 
			
		||||
            else
 | 
			
		||||
              @failure_message = "#{class_name} is making " <<
 | 
			
		||||
                "#{readonly_attributes.to_a.to_sentence} " <<
 | 
			
		||||
                "read-only, but not #{@attribute}."
 | 
			
		||||
                                 "#{readonly_attributes.to_a.to_sentence} " <<
 | 
			
		||||
                                 "read-only, but not #{@attribute}."
 | 
			
		||||
            end
 | 
			
		||||
            false
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,12 +63,14 @@ module Shoulda
 | 
			
		|||
 | 
			
		||||
        def failure_message
 | 
			
		||||
          return if !@errors
 | 
			
		||||
 | 
			
		||||
          "Expected #{@subject.class} to #{description} but the following " \
 | 
			
		||||
          "errors were found: #{@errors.join(', ')}"
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        def failure_message_when_negated
 | 
			
		||||
          return if !@errors
 | 
			
		||||
 | 
			
		||||
          "Did not expect #{@subject.class} to have secure token " \
 | 
			
		||||
          ":#{token_attribute}"
 | 
			
		||||
        end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -795,7 +795,7 @@ module Shoulda
 | 
			
		|||
          column = column_for(scope)
 | 
			
		||||
 | 
			
		||||
          if column.respond_to?(:array) && column.array
 | 
			
		||||
            [ dummy_scalar_value_for(column) ]
 | 
			
		||||
            [dummy_scalar_value_for(column)]
 | 
			
		||||
          else
 | 
			
		||||
            dummy_scalar_value_for(column)
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			@ -807,7 +807,7 @@ module Shoulda
 | 
			
		|||
 | 
			
		||||
        def next_value_for(scope, previous_value)
 | 
			
		||||
          if previous_value.is_a?(Array)
 | 
			
		||||
            [ next_scalar_value_for(scope, previous_value[0]) ]
 | 
			
		||||
            [next_scalar_value_for(scope, previous_value[0])]
 | 
			
		||||
          else
 | 
			
		||||
            next_scalar_value_for(scope, previous_value)
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -245,7 +245,7 @@ module Shoulda
 | 
			
		|||
        def with_prefix(prefix = nil)
 | 
			
		||||
          @delegating_method =
 | 
			
		||||
            :"#{build_delegating_method_prefix(prefix)}_#{delegate_method}"
 | 
			
		||||
            delegate_method
 | 
			
		||||
          delegate_method
 | 
			
		||||
          self
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -446,7 +446,7 @@ module Shoulda
 | 
			
		|||
            calls_on_delegate_object.each_with_index do |call, i|
 | 
			
		||||
              name = call.method_name
 | 
			
		||||
              args = call.args.map { |arg| arg.inspect }.join(', ')
 | 
			
		||||
              string << "#{i+1}) #{name}(#{args})\n"
 | 
			
		||||
              string << "#{i + 1}) #{name}(#{args})\n"
 | 
			
		||||
            end
 | 
			
		||||
          else
 | 
			
		||||
            string << ' (none)'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ Shoulda::Matchers.configure do |config|
 | 
			
		|||
    with.test_framework :test_unit
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
EOT
 | 
			
		||||
            EOT
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def include(*modules, **options); end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ module Shoulda
 | 
			
		|||
 | 
			
		||||
      def self.deconstantize(path)
 | 
			
		||||
        if defined?(ActiveSupport::Inflector) &&
 | 
			
		||||
          ActiveSupport::Inflector.respond_to?(:deconstantize)
 | 
			
		||||
           ActiveSupport::Inflector.respond_to?(:deconstantize)
 | 
			
		||||
          ActiveSupport::Inflector.deconstantize(path)
 | 
			
		||||
        else
 | 
			
		||||
          path.to_s[0...(path.to_s.rindex('::') || 0)]
 | 
			
		||||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ module Shoulda
 | 
			
		|||
 | 
			
		||||
      def self.safe_constantize(camel_cased_word)
 | 
			
		||||
        if defined?(ActiveSupport::Inflector) &&
 | 
			
		||||
          ActiveSupport::Inflector.respond_to?(:safe_constantize)
 | 
			
		||||
           ActiveSupport::Inflector.respond_to?(:safe_constantize)
 | 
			
		||||
          ActiveSupport::Inflector.safe_constantize(camel_cased_word)
 | 
			
		||||
        else
 | 
			
		||||
          begin
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +30,7 @@ module Shoulda
 | 
			
		|||
 | 
			
		||||
      def self.indent(string, width)
 | 
			
		||||
        return if !string
 | 
			
		||||
 | 
			
		||||
        indentation = ' ' * width
 | 
			
		||||
        string.split(/[\n\r]/).map { |line| indentation + line }.join("\n")
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ module Shoulda
 | 
			
		|||
          leftover = ''
 | 
			
		||||
        else
 | 
			
		||||
          fitted_line = line[0..index].rstrip
 | 
			
		||||
          leftover = line[index + 1 .. -1]
 | 
			
		||||
          leftover = line[index + 1..-1]
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        { fitted_line: fitted_line, leftover: leftover }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ require 'rspec/core'
 | 
			
		|||
 | 
			
		||||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
Dir[ File.join(File.expand_path('support/acceptance/**/*.rb', __dir__)) ].sort.each do |file|
 | 
			
		||||
Dir[File.join(File.expand_path('support/acceptance/**/*.rb', __dir__))].sort.each do |file|
 | 
			
		||||
  require file
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ module AcceptanceTests
 | 
			
		|||
      files = []
 | 
			
		||||
 | 
			
		||||
      if integrates_with_nunit_and_rails?(test_framework, libraries) ||
 | 
			
		||||
        integrates_with_nunit_only?(test_framework)
 | 
			
		||||
         integrates_with_nunit_only?(test_framework)
 | 
			
		||||
        files << 'test/test_helper.rb'
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ module AcceptanceTests
 | 
			
		|||
 | 
			
		||||
      def failure_message
 | 
			
		||||
        message = "Expected output to indicate that #{some_tests_were_run}.\n" +
 | 
			
		||||
          "Expected output: #{expected_output}\n"
 | 
			
		||||
                  "Expected output: #{expected_output}\n"
 | 
			
		||||
 | 
			
		||||
        if actual_output.empty?
 | 
			
		||||
          message << 'Actual output: (empty)'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ module AcceptanceTests
 | 
			
		|||
      def expected_output_for_turn
 | 
			
		||||
        full_report = series.map do |number|
 | 
			
		||||
          "pass: #{number},  fail: 0,  error: 0"
 | 
			
		||||
      end.join('.+')
 | 
			
		||||
        end.join('.+')
 | 
			
		||||
 | 
			
		||||
        Regexp.new(full_report, Regexp::MULTILINE)
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ module Tests
 | 
			
		|||
      )
 | 
			
		||||
      @env = extract_env_from(@options)
 | 
			
		||||
 | 
			
		||||
      @wrapper = ->(block) { block.call }
 | 
			
		||||
      @wrapper = -> (block) { block.call }
 | 
			
		||||
      @command_prefix = ''
 | 
			
		||||
      self.directory = Dir.pwd
 | 
			
		||||
      @run_quickly = false
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,8 +10,7 @@ module UnitTests
 | 
			
		|||
    def builder_for_record_validating_confirmation_with_18n_message(options = {})
 | 
			
		||||
      builder = builder_for_record_validating_confirmation(options)
 | 
			
		||||
      RecordBuilderWithI18nValidationMessage.new(builder,
 | 
			
		||||
        validation_message_key: :confirmation,
 | 
			
		||||
      )
 | 
			
		||||
        validation_message_key: :confirmation,)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ module UnitTests
 | 
			
		|||
        layout false
 | 
			
		||||
        define_method(action, &block)
 | 
			
		||||
      end
 | 
			
		||||
      controller_class.view_paths = [ $test_app.temp_views_directory.to_s ]
 | 
			
		||||
      controller_class.view_paths = [$test_app.temp_views_directory.to_s]
 | 
			
		||||
 | 
			
		||||
      define_routes do
 | 
			
		||||
        get 'examples', to: "examples##{action}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ describe Shoulda::Matchers::ActionController::RenderTemplateMatcher, type: :cont
 | 
			
		|||
  context 'a controller that renders a partial several times' do
 | 
			
		||||
    it 'accepts rendering that partial twice' do
 | 
			
		||||
      controller = build_fake_response(partial: '_customer') do
 | 
			
		||||
        render partial: 'customer', collection: [1,2]
 | 
			
		||||
        render partial: 'customer', collection: [1, 2]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      expect(controller).to render_template(partial: '_customer', count: 2)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,6 @@ describe Shoulda::Matchers::ActionController::RenderWithLayoutMatcher, type: :co
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  context 'a controller that renders without a layout' do
 | 
			
		||||
 | 
			
		||||
    it 'rejects rendering with a layout' do
 | 
			
		||||
      controller_without_layout = build_fake_response { render layout: false }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@ require 'unit_spec_helper'
 | 
			
		|||
 | 
			
		||||
describe Shoulda::Matchers::ActionController::RespondWithMatcher, type: :controller do
 | 
			
		||||
  statuses = { success: 200, redirect: 301, missing: 404, error: 500,
 | 
			
		||||
    not_implemented: 501, }
 | 
			
		||||
               not_implemented: 501, }
 | 
			
		||||
 | 
			
		||||
  statuses.each do |human_name, numeric_code|
 | 
			
		||||
    context "a controller responding with #{human_name}" do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ describe Shoulda::Matchers::ActionController::RouteParams, type: :controller do
 | 
			
		|||
    context 'when the route params is a string' do
 | 
			
		||||
      it 'produces a hash of route params' do
 | 
			
		||||
        expect(build_route_params('examples#index').normalize).
 | 
			
		||||
          to eq({ controller: 'examples', action: 'index'})
 | 
			
		||||
          to eq({ controller: 'examples', action: 'index' })
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ describe Shoulda::Matchers::ActiveModel::AllowMassAssignmentOfMatcher, type: :mo
 | 
			
		|||
    context 'an attribute that is not whitelisted for mass-assignment' do
 | 
			
		||||
      it 'rejects being mass-assignable' do
 | 
			
		||||
        model = define_model(:example, not_whitelisted: :string,
 | 
			
		||||
          whitelisted: :string,) do
 | 
			
		||||
                                       whitelisted: :string,) do
 | 
			
		||||
          attr_accessible :whitelisted
 | 
			
		||||
        end.new
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ describe Shoulda::Matchers::ActiveModel::AllowMassAssignmentOfMatcher, type: :mo
 | 
			
		|||
    context 'an attribute not included in the mass-assignment blacklist' do
 | 
			
		||||
      it 'accepts being mass-assignable' do
 | 
			
		||||
        model = define_model(:example, not_blacklisted: :string,
 | 
			
		||||
          blacklisted: :string,) do
 | 
			
		||||
                                       blacklisted: :string,) do
 | 
			
		||||
          attr_protected :blacklisted
 | 
			
		||||
        end.new
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -464,7 +464,7 @@ indeed invalid, but it produced these validation errors instead:
 | 
			
		|||
        validates_presence_of     :attr
 | 
			
		||||
        validates_length_of       :attr, within: 1..5
 | 
			
		||||
        validates_numericality_of :attr, greater_than_or_equal_to: 1,
 | 
			
		||||
          less_than_or_equal_to: 50000
 | 
			
		||||
                                         less_than_or_equal_to: 50000
 | 
			
		||||
      end.new
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -784,7 +784,7 @@ that attribute does not exist.
 | 
			
		|||
          message = <<-MESSAGE.rstrip
 | 
			
		||||
The matcher attempted to set :nonexistent on the Example to "some
 | 
			
		||||
value", but that attribute does not exist.
 | 
			
		||||
        MESSAGE
 | 
			
		||||
          MESSAGE
 | 
			
		||||
 | 
			
		||||
          expect(&assertion).to raise_error(
 | 
			
		||||
            described_class::AttributeDoesNotExistError,
 | 
			
		||||
| 
						 | 
				
			
			@ -810,7 +810,7 @@ value", but that attribute does not exist.
 | 
			
		|||
          message = <<-MESSAGE.rstrip
 | 
			
		||||
The matcher attempted to set :nonexistent on the Example to "some
 | 
			
		||||
value", but that attribute does not exist.
 | 
			
		||||
        MESSAGE
 | 
			
		||||
          MESSAGE
 | 
			
		||||
 | 
			
		||||
          expect(&assertion).to raise_error(
 | 
			
		||||
            described_class::AttributeDoesNotExistError,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,8 +37,7 @@ describe Shoulda::Matchers::ActiveModel::DisallowValueMatcher, type: :model do
 | 
			
		|||
 | 
			
		||||
    it "delegates its failure message to its allow matcher's negative failure message" do
 | 
			
		||||
      allow_matcher = double('allow_matcher',
 | 
			
		||||
        failure_message_when_negated: 'allow matcher failure',
 | 
			
		||||
      ).as_null_object
 | 
			
		||||
        failure_message_when_negated: 'allow matcher failure',).as_null_object
 | 
			
		||||
      allow(Shoulda::Matchers::ActiveModel::AllowValueMatcher).
 | 
			
		||||
        to receive(:new).
 | 
			
		||||
        and_return(allow_matcher)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
# encoding: UTF-8
 | 
			
		||||
 | 
			
		||||
require 'unit_spec_helper'
 | 
			
		||||
 | 
			
		||||
describe Shoulda::Matchers::ActiveModel::Helpers do
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +82,7 @@ describe Shoulda::Matchers::ActiveModel::Helpers do
 | 
			
		|||
    context 'if ActiveModel::Errors#generate_message behavior has changed' do
 | 
			
		||||
      it 'provides the right error message for validate_presence_of' do
 | 
			
		||||
        stub_active_model_message_generation(type: :blank,
 | 
			
		||||
                                              message: 'Behavior has diverged.',)
 | 
			
		||||
                                             message: 'Behavior has diverged.',)
 | 
			
		||||
        assert_presence_validation_has_correct_message
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +102,7 @@ describe Shoulda::Matchers::ActiveModel::Helpers do
 | 
			
		|||
    expect(record).to validate_length_of(:attr).is_equal_to(40)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def store_translations(options = {without: []})
 | 
			
		||||
  def store_translations(options = { without: [] })
 | 
			
		||||
    options[:without] = Array.wrap(options[:without] || [])
 | 
			
		||||
 | 
			
		||||
    translations = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -203,7 +203,7 @@ could not be proved.
 | 
			
		|||
 | 
			
		||||
      it 'does not raise an exception' do
 | 
			
		||||
        stub_translation('activerecord.errors.messages.present',
 | 
			
		||||
                         '%{attribute} must be blank in a %{model}',)
 | 
			
		||||
          '%{attribute} must be blank in a %{model}',)
 | 
			
		||||
 | 
			
		||||
        expect {
 | 
			
		||||
          expect(validating_absence_of(:attr)).to validate_absence_of(:attr)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ to ‹5›, but this could not be proved.
 | 
			
		|||
    it 'accepts ensuring the correct range with an interpolated variable in the message' do
 | 
			
		||||
      matcher = validating_exclusion(in: 2..4, message: '%{value} is not good')
 | 
			
		||||
      expect(matcher).
 | 
			
		||||
      to validate_exclusion_of(:attr).
 | 
			
		||||
        to validate_exclusion_of(:attr).
 | 
			
		||||
        in_range(2..4).
 | 
			
		||||
        with_message(/^[234] is not good$/)
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			@ -203,7 +203,7 @@ but this could not be proved.
 | 
			
		|||
  this test is failing. If you've overridden the writer method for this
 | 
			
		||||
  attribute, then you may need to change it to make this test pass, or
 | 
			
		||||
  do something else entirely.
 | 
			
		||||
        MESSAGE
 | 
			
		||||
          MESSAGE
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
      model_creator: :active_model,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -241,7 +241,8 @@ could not be proved.
 | 
			
		|||
      before do
 | 
			
		||||
        stub_translation(
 | 
			
		||||
          'activerecord.errors.messages.too_long',
 | 
			
		||||
          'The %{attribute} of your %{model} is too long (maximum is %{count} characters)',)
 | 
			
		||||
          'The %{attribute} of your %{model} is too long (maximum is %{count} characters)',
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not raise an exception' do
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +257,8 @@ could not be proved.
 | 
			
		|||
      before do
 | 
			
		||||
        stub_translation(
 | 
			
		||||
          'activerecord.errors.messages.too_short',
 | 
			
		||||
          'The %{attribute} of your %{model} is too short (minimum is %{count} characters)',)
 | 
			
		||||
          'The %{attribute} of your %{model} is too short (minimum is %{count} characters)',
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not raise an exception' do
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +272,8 @@ could not be proved.
 | 
			
		|||
      before do
 | 
			
		||||
        stub_translation(
 | 
			
		||||
          'activerecord.errors.messages.wrong_length',
 | 
			
		||||
          'The %{attribute} of your %{model} is the wrong length (should be %{count} characters)',)
 | 
			
		||||
          'The %{attribute} of your %{model} is the wrong length (should be %{count} characters)',
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'does not raise an exception' do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -886,7 +886,8 @@ could not be proved.
 | 
			
		|||
    before do
 | 
			
		||||
      stub_translation(
 | 
			
		||||
        'activerecord.errors.messages.blank',
 | 
			
		||||
        'Please enter a %{attribute} for your %{model}',)
 | 
			
		||||
        'Please enter a %{attribute} for your %{model}',
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    after { I18n.backend.reload! }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -858,10 +858,9 @@ describe Shoulda::Matchers::ActiveRecord::AssociationMatcher, type: :model do
 | 
			
		|||
 | 
			
		||||
    it 'accepts a valid association with a :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
 | 
			
		||||
      end
 | 
			
		||||
      define_model :parent do
 | 
			
		||||
        has_many :conceptions
 | 
			
		||||
        has_many :children, through: :conceptions
 | 
			
		||||
| 
						 | 
				
			
			@ -877,11 +876,9 @@ describe Shoulda::Matchers::ActiveRecord::AssociationMatcher, type: :model do
 | 
			
		|||
        has_many :children, through: :conceptions
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      expect { have_many(:children) }
 | 
			
		||||
        .not_to match_against(parent_class.new)
 | 
			
		||||
        .and_fail_with(<<-MESSAGE)
 | 
			
		||||
      expect { have_many(:children) }.not_to match_against(parent_class.new).and_fail_with(<<-MESSAGE)
 | 
			
		||||
Expected Parent to have a has_many association called children through conceptions (Could not find the source association(s) "child" or :children in model Conception. Try 'has_many :children, :through => :conceptions, :source => <name>'. Is it one of ?)
 | 
			
		||||
        MESSAGE
 | 
			
		||||
      MESSAGE
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'accepts a valid association with an :as option' do
 | 
			
		||||
| 
						 | 
				
			
			@ -920,7 +917,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 :child, caretaker_type: :string,
 | 
			
		||||
        caretaker_id: :integer
 | 
			
		||||
                           caretaker_id: :integer
 | 
			
		||||
      define_model :parent do
 | 
			
		||||
        has_many :children, as: :guardian
 | 
			
		||||
      end
 | 
			
		||||
| 
						 | 
				
			
			@ -940,7 +937,7 @@ Expected Parent to have a has_many association called children through conceptio
 | 
			
		|||
      define_model :child
 | 
			
		||||
 | 
			
		||||
      define_model :conception, child_id: :integer,
 | 
			
		||||
        parent_id: :integer do
 | 
			
		||||
                                parent_id: :integer do
 | 
			
		||||
        belongs_to :child
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1251,7 +1248,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
 | 
			
		||||
| 
						 | 
				
			
			@ -1294,7 +1291,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
 | 
			
		||||
| 
						 | 
				
			
			@ -1442,7 +1439,6 @@ Expected Parent to have a has_many association called children through conceptio
 | 
			
		|||
      }.to fail_with_message(message)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    it 'accepts an association with a through' do
 | 
			
		||||
      define_model :detail
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1539,7 +1535,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
 | 
			
		||||
| 
						 | 
				
			
			@ -1967,19 +1963,17 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
 | 
			
		|||
        define_model :relative
 | 
			
		||||
        define_model :person do
 | 
			
		||||
          has_and_belongs_to_many :relatives,
 | 
			
		||||
                                  foreign_key: :some_foreign_key_id,
 | 
			
		||||
                                  association_foreign_key: :custom_association_foreign_key_id
 | 
			
		||||
            foreign_key: :some_foreign_key_id,
 | 
			
		||||
            association_foreign_key: :custom_association_foreign_key_id
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        define_model :people_relative,
 | 
			
		||||
                     id: false,
 | 
			
		||||
                     custom_association_foreign_key_id: :integer,
 | 
			
		||||
                     some_foreign_key_id: :integer
 | 
			
		||||
          id: false,
 | 
			
		||||
          custom_association_foreign_key_id: :integer,
 | 
			
		||||
          some_foreign_key_id: :integer
 | 
			
		||||
 | 
			
		||||
        expect(Person.new).to have_and_belong_to_many(:relatives)
 | 
			
		||||
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'rejects an association of the wrong type' do
 | 
			
		||||
| 
						 | 
				
			
			@ -1997,7 +1991,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
 | 
			
		||||
| 
						 | 
				
			
			@ -2008,7 +2002,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
 | 
			
		||||
| 
						 | 
				
			
			@ -2025,7 +2019,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
 | 
			
		||||
| 
						 | 
				
			
			@ -2141,7 +2135,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
 | 
			
		||||
| 
						 | 
				
			
			@ -2154,7 +2148,7 @@ Expected Person to have a has_and_belongs_to_many association called relatives (
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def define_association_with_conditions(model, macro, name, conditions, other_options={})
 | 
			
		||||
  def define_association_with_conditions(model, macro, name, conditions, other_options = {})
 | 
			
		||||
    args = []
 | 
			
		||||
    options = {}
 | 
			
		||||
    if active_record_supports_relations?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,11 +71,11 @@ describe Shoulda::Matchers::ActiveRecord::HaveRichTextMatcher, type: :model do
 | 
			
		|||
 | 
			
		||||
  def new_post(has_invalid_content: false, is_rich_text_association: false)
 | 
			
		||||
    columns = {}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
    if has_invalid_content
 | 
			
		||||
      columns[:invalid_content] = :string
 | 
			
		||||
    end
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
    define_model 'Post', columns do
 | 
			
		||||
      if is_rich_text_association
 | 
			
		||||
        has_rich_text :content
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ require 'unit_spec_helper'
 | 
			
		|||
# rubocop:disable Metrics/BlockLength
 | 
			
		||||
describe Shoulda::Matchers::ActiveRecord::HaveSecureTokenMatcher,
 | 
			
		||||
  type: :model do
 | 
			
		||||
 | 
			
		||||
  if active_record_supports_has_secure_token?
 | 
			
		||||
    describe '#description' do
 | 
			
		||||
      it 'returns the message including the name of the default column' do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ describe Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher, type: :mo
 | 
			
		|||
 | 
			
		||||
        it 'still accepts if the scope is unset beforehand' do
 | 
			
		||||
          record = build_record_validating_uniqueness(
 | 
			
		||||
            scopes: [ build_attribute(name: :scope, value: nil) ],
 | 
			
		||||
            scopes: [build_attribute(name: :scope, value: nil)],
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          expect(record).to validate_uniqueness.scoped_to(:scope)
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ describe Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher, type: :mo
 | 
			
		|||
 | 
			
		||||
        it 'still accepts if the scope is unset beforehand' do
 | 
			
		||||
          record = create_record_validating_uniqueness(
 | 
			
		||||
            scopes: [ build_attribute(name: :scope, value: nil) ],
 | 
			
		||||
            scopes: [build_attribute(name: :scope, value: nil)],
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          expect(record).to validate_uniqueness.scoped_to(:scope)
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ describe Shoulda::Matchers::ActiveRecord::ValidateUniquenessOfMatcher, type: :mo
 | 
			
		|||
        value2 = next_version_of(value1, value_type)
 | 
			
		||||
        value3 = next_version_of(value2, value_type)
 | 
			
		||||
        model = define_model_validating_uniqueness(
 | 
			
		||||
          scopes: [ build_attribute(name: :scope) ],
 | 
			
		||||
          scopes: [build_attribute(name: :scope)],
 | 
			
		||||
        )
 | 
			
		||||
        create_record_from(model, scope: value2)
 | 
			
		||||
        create_record_from(model, scope: value3)
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ within the scope of :scope1, but this could not be proved.
 | 
			
		|||
    context 'when a different scope is specified' do
 | 
			
		||||
      it 'rejects with an appropriate failure message' do
 | 
			
		||||
        record = build_record_validating_uniqueness(
 | 
			
		||||
          scopes: [ build_attribute(name: :other) ],
 | 
			
		||||
          scopes: [build_attribute(name: :other)],
 | 
			
		||||
          additional_attributes: [:scope],
 | 
			
		||||
        )
 | 
			
		||||
        assertion = lambda do
 | 
			
		||||
| 
						 | 
				
			
			@ -145,7 +145,7 @@ within the scope of :scope, but this could not be proved.
 | 
			
		|||
    context 'when no scope is specified' do
 | 
			
		||||
      it 'rejects with an appropriate failure message' do
 | 
			
		||||
        record = build_record_validating_uniqueness(
 | 
			
		||||
          scopes: [ build_attribute(name: :scope) ],
 | 
			
		||||
          scopes: [build_attribute(name: :scope)],
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        assertion = lambda do
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ this could not be proved.
 | 
			
		|||
      context 'if the scope attribute is unset in the record given to the matcher' do
 | 
			
		||||
        it 'rejects with an appropriate failure message' do
 | 
			
		||||
          record = build_record_validating_uniqueness(
 | 
			
		||||
            scopes: [ build_attribute(name: :scope, value: nil) ],
 | 
			
		||||
            scopes: [build_attribute(name: :scope, value: nil)],
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          assertion = lambda do
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +188,7 @@ this could not be proved.
 | 
			
		|||
      context 'when there is more than one scope' do
 | 
			
		||||
        it 'rejects with an appropriate failure message (and does not raise an error)' do
 | 
			
		||||
          record = build_record_validating_uniqueness(
 | 
			
		||||
            scopes: [ build_attribute(name: :scope) ],
 | 
			
		||||
            scopes: [build_attribute(name: :scope)],
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          assertion = lambda do
 | 
			
		||||
| 
						 | 
				
			
			@ -208,7 +208,7 @@ within the scope of :non_existent, but this could not be proved.
 | 
			
		|||
      context 'when there is more than one scope' do
 | 
			
		||||
        it 'rejects with an appropriate failure message (and does not raise an error)' do
 | 
			
		||||
          record = build_record_validating_uniqueness(
 | 
			
		||||
            scopes: [ build_attribute(name: :scope) ],
 | 
			
		||||
            scopes: [build_attribute(name: :scope)],
 | 
			
		||||
          )
 | 
			
		||||
 | 
			
		||||
          assertion = lambda do
 | 
			
		||||
| 
						 | 
				
			
			@ -1548,7 +1548,7 @@ this could not be proved.
 | 
			
		|||
 | 
			
		||||
  def next_version_of(value, value_type)
 | 
			
		||||
    if value.is_a?(Array)
 | 
			
		||||
      [ next_version_of(value[0], value_type) ]
 | 
			
		||||
      [next_version_of(value[0], value_type)]
 | 
			
		||||
    elsif value_type == :uuid
 | 
			
		||||
      SecureRandom.uuid
 | 
			
		||||
    elsif value.is_a?(Time)
 | 
			
		||||
| 
						 | 
				
			
			@ -1632,7 +1632,7 @@ this could not be proved.
 | 
			
		|||
    options = options.dup
 | 
			
		||||
    enum_scope_attribute =
 | 
			
		||||
      normalize_attribute(options.delete(:enum_scope)).
 | 
			
		||||
      merge(value_type: :integer, column_type: :integer)
 | 
			
		||||
        merge(value_type: :integer, column_type: :integer)
 | 
			
		||||
    additional_scopes = options.delete(:additional_scopes) { [] }
 | 
			
		||||
    options[:scopes] = [enum_scope_attribute] + additional_scopes
 | 
			
		||||
    dummy_enum_values = [:foo, :bar]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,8 +186,7 @@ module Shoulda::Matchers::Doublespeak
 | 
			
		|||
          object: instance,
 | 
			
		||||
          method_name: method_name,
 | 
			
		||||
          args: expected_args,
 | 
			
		||||
          block: expected_block,
 | 
			
		||||
        )
 | 
			
		||||
          block: expected_block,)
 | 
			
		||||
        double = described_class.new(
 | 
			
		||||
          world,
 | 
			
		||||
          klass,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -610,6 +610,7 @@ to account for when #country *was* nil.
 | 
			
		|||
 | 
			
		||||
            def hello
 | 
			
		||||
              return unless country
 | 
			
		||||
 | 
			
		||||
              country.hello
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ require 'spec_helper'
 | 
			
		|||
 | 
			
		||||
$VERBOSE = true
 | 
			
		||||
 | 
			
		||||
Dir[ File.join(File.expand_path('support/unit/**/*.rb', __dir__)) ].sort.each do |file|
 | 
			
		||||
Dir[File.join(File.expand_path('support/unit/**/*.rb', __dir__))].sort.each do |file|
 | 
			
		||||
  require file
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue