13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/spec/rails/example/routing_helpers.rb', line 13
def ==(expected)
if Hash === expected
path, querystring = expected[:path].split('?')
path_string = path
path = expected.merge(:path => path)
else
path, querystring = expected.split('?')
path_string = path
path = { :path => path, :method => :get }
end
params = querystring.blank? ? {} : Rack::Utils.parse_query(querystring).symbolize_keys!
begin
@example.assert_routing(path, @options, {}, params)
true
rescue ActionController::RoutingError, ::Test::Unit::AssertionFailedError => e
raise e.class, "#{e}\nIf you're expecting this failure, we suggest {:#{path[:method]}=>\"#{path[:path]}\"}.should_not be_routable"
end
end
|