Created
November 18, 2009 15:59
-
-
Save monde/237987 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Test::Unit::TestCase | |
def self.should_route_glob(method, path, options) | |
unless options[:controller] | |
options[:controller] = self.name.gsub(/ControllerTest$/, '').tableize | |
end | |
options[:controller] = options[:controller].to_s | |
options[:action] = options[:action].to_s | |
populated_path = path.dup | |
options.each do |key, value| | |
options[key] = value if value.respond_to? :to_param | |
populated_path.gsub!(key.inspect, value.to_s) | |
end | |
should_name = "route #{method.to_s.upcase} #{populated_path} to/from #{options.inspect}" | |
should should_name do | |
assert_routing({:method => method, :path => populated_path}, options) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment