Created
March 10, 2009 20:52
-
-
Save robholland/77126 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
def be_like(expected_values) | |
case expected_values | |
when Cucumber::Ast::Table | |
expected_values = expected_values.hashes | |
end | |
simple_matcher do |actual_values| | |
expected_values.each_with_index do |expected_hash, index| | |
unless actual_hash = actual_values[index] | |
# FIXME: Find a nicer way to get a useful error message | |
{}.should include(expected_hash) | |
end | |
expected_hash.each_pair do |k,v| | |
actual_values[index].should include(k => v) | |
end | |
end | |
actual_values[expected_values.size].should be_nil | |
end | |
end | |
Then /'(.*)' queue should be like:$/ do |name, elements| | |
expected_elements = elements.hashes | |
expected_elements.each do |element| | |
element['node_id'] = Node.find_by_name(element.delete('node')).id | |
end | |
element_attributes = QueueElement.find_by_name(name) | |
element_attributes.should be_like(expected_elements) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment