From b06d351b701906efab737894be674c66561ec524 Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Fri, 16 May 2008 17:10:35 -0700 Subject: this is as close as it's been --- spec/matchers/disambiguate_attributes.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/matchers/disambiguate_attributes.rb (limited to 'spec/matchers/disambiguate_attributes.rb') diff --git a/spec/matchers/disambiguate_attributes.rb b/spec/matchers/disambiguate_attributes.rb new file mode 100644 index 0000000000..bee7d22b0c --- /dev/null +++ b/spec/matchers/disambiguate_attributes.rb @@ -0,0 +1,28 @@ +module DisambiguateAttributesMatcher + 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 \ No newline at end of file -- cgit v1.2.3