2010-10-05 17:09:37 +00:00
|
|
|
RSpec::Matchers.define :orderlessly_match do |original_string|
|
2010-07-20 23:00:22 +00:00
|
|
|
match do |given_string|
|
2010-07-21 18:56:19 +00:00
|
|
|
original_string.split('').sort == given_string.split('').sort
|
2010-07-20 23:00:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
failure_message_for_should do |given_string|
|
|
|
|
"expected \"#{given_string}\" to have the same characters as \"#{original_string}\""
|
|
|
|
end
|
|
|
|
|
|
|
|
failure_message_for_should_not do |given_string|
|
|
|
|
"expected \"#{given_string}\" not to have the same characters as \"#{original_string}\""
|
|
|
|
end
|
|
|
|
end
|