-
-
Save rsim/cab526d685d4103b5ce7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Matchers | |
class BeLike | |
def initialize(expected) | |
@expected = expected.gsub(/\s+/, ' ').strip | |
end | |
def matches?(actual) | |
@actual = actual.gsub(/\s+/, ' ').strip | |
@expected == @actual | |
end | |
def failure_message | |
"expected\n#{@actual}\nto be like\n#{@expected}" | |
end | |
def negative_failure_message | |
"expected\n#{@actual}\nto be unlike\n#{@expected}" | |
end | |
end | |
def be_like(expected) | |
BeLike.new(expected) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should render to XML with attributes" do | |
@schema.define('FoodMart') do | |
description 'Demo "FoodMart" schema' | |
end | |
@schema.to_xml.should be_like <<-XML | |
<?xml version="1.0"?> | |
<Schema name="FoodMart" description="Demo "FoodMart" schema"/> | |
XML | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment