From c34b6b092ab0d5a620b10098f43f59d7cebb85a4 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 19 May 2020 17:06:43 -0700 Subject: [PATCH] Move tests higher up the stack Journey is considered internal, and I would like to stop testing internals so that we are free to refactor. This commit just moves us up one more call frame with the goal if getting closer to a public API. Once we're up the stack high enough that we're testing a public API we can stop --- actionpack/test/journey/router_test.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index 4c62adb0a8..f57eaf4631 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "abstract_unit" +require "rack/utils" module ActionDispatch module Journey @@ -230,7 +231,7 @@ module ActionDispatch path, params = _generate( nil, { id: 1, controller: "tasks", action: "show" }, {}) assert_equal "/tasks/show", path - assert_equal({ id: 1 }, params) + assert_equal({ id: "1" }, params) end def test_generate_escapes @@ -263,7 +264,7 @@ module ActionDispatch relative_url_root: nil }, {}) assert_equal "/tasks/show", path - assert_equal({ id: 1, relative_url_root: nil }, params) + assert_equal({ id: "1" }, params) end def test_generate_missing_keys_no_matches_different_format_keys @@ -487,8 +488,14 @@ module ActionDispatch end private - def _generate(*args) - ActionDispatch::Routing::RouteSet::Generator.new(*args, @route_set).generate(nil).to_ary + def _generate(route_name, options, recall) + if recall + options = options.merge(:_recall => recall) + end + path = @route_set.path_for(options, route_name) + uri = URI.parse path + params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys + [uri.path, params] end def get(*args)