Sha256: 1a6b31d651663f9abb2a976e09790a9b03cecf15304ea7068f56f738eb3e51d1
Contents?: true
Size: 797 Bytes
Versions: 5
Compression:
Stored size: 797 Bytes
Contents
module ActionController class TestCase protected def assert_named_route(result, name) assert_equal result, named_routes[name.to_s] end def named_routes @named_routes ||= Hash[*begin if Rails::VERSION::MAJOR >= 3 Rails.application.routes.routes.collect do |route| [route.name, route.path.gsub("(.:format)", "")] unless route.name.blank? end else ActionController::Routing::Routes.routes.collect do |route| name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s path = route.segments.collect(&:to_s).join path.chop! if path.length > 1 [name, path] unless name.blank? end end end.compact.flatten] end end end
Version data entries
5 entries across 5 versions & 2 rubygems