Sha256: d0ceafa7b619d001c1704b0da79745243bb0b400523e7762f2905ffb48efe07e

Contents?: true

Size: 698 Bytes

Versions: 7

Compression:

Stored size: 698 Bytes

Contents

module Matchers
  class DisambiguateAttributes
    def initialize(attributes)
      @attributes = attributes
    end

    def matches?(actual)
      @actual = actual
      attribute1, attribute2 = @attributes
      @actual[attribute1].descends_from?(attribute1) &&
        !@actual[attribute1].descends_from?(attribute2) &&
        @actual[attribute2].descends_from?(attribute2)
    end

    def failure_message
      ""
      # "expected #{@actual} to disambiguate its attributes"
    end

    def negative_failure_message
      "expected #{@actual} to not disambiguate its attributes"
    end
  end

  def disambiguate_attributes(*attributes)
    DisambiguateAttributes.new(attributes)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
arel-1.0.1 spec/support/matchers/disambiguate_attributes.rb
arel-1.0.0 spec/support/matchers/disambiguate_attributes.rb
arel-1.0.0.rc1 spec/support/matchers/disambiguate_attributes.rb
arel-compat-0.4.0 spec/support/matchers/disambiguate_attributes.rb
arel-0.4.0 spec/support/matchers/disambiguate_attributes.rb
arel-0.3.3 spec/support/matchers/disambiguate_attributes.rb
arel-0.3.2 spec/support/matchers/disambiguate_attributes.rb