Permalink
Browse files

use sprintf rather than build_message

  • Loading branch information...
1 parent a0bab37 commit a0dc9cae88cd98ccd9ce6788237c6d0855bbf119 @tenderlove tenderlove committed Jan 6, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -45,9 +45,11 @@ def assert_recognizes(expected_options, path, extras={}, message=nil)
extras.each_key { |key| expected_options.delete key } unless extras.nil?
expected_options.stringify_keys!
- msg = build_message(message, "The recognized options <?> did not match <?>, difference: <?>",
+
+ # FIXME: minitest does object diffs, do we need to have our own?
+ message ||= sprintf("The recognized options <%s> did not match <%s>, difference: <%s>",
request.path_parameters, expected_options, expected_options.diff(request.path_parameters))
- assert_equal(expected_options, request.path_parameters, msg)
+ assert_equal(expected_options, request.path_parameters, message)
end
# Asserts that the provided options can be used to generate the provided path. This is the inverse of +assert_recognizes+.
@@ -84,10 +86,10 @@ def assert_generates(expected_path, options, defaults={}, extras = {}, message=n
generated_path, extra_keys = @routes.generate_extras(options, defaults)
found_extras = options.reject {|k, v| ! extra_keys.include? k}
- msg = build_message(message, "found extras <?>, not <?>", found_extras, extras)
+ msg = message || sprintf("found extras <%s>, not <%s>", found_extras, extras)
assert_equal(extras, found_extras, msg)
- msg = build_message(message, "The generated path <?> did not match <?>", generated_path,
+ msg = message || sprintf("The generated path <%s> did not match <%s>", generated_path,
expected_path)
assert_equal(expected_path, generated_path, msg)
end

0 comments on commit a0dc9ca

Please sign in to comment.