Skip to content

Commit

Permalink
Move tests higher up the stack
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tenderlove committed May 20, 2020
1 parent a4395a9 commit c34b6b0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions actionpack/test/journey/router_test.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "abstract_unit"
require "rack/utils"

module ActionDispatch
module Journey
Expand Down Expand Up @@ -230,7 +231,7 @@ def test_generate_id
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
Expand Down Expand Up @@ -263,7 +264,7 @@ def test_generate_extra_params
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
Expand Down Expand Up @@ -487,8 +488,14 @@ def test_eager_load_without_routes
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)

This comment has been minimized.

Copy link
@alipman88

alipman88 May 20, 2020

Contributor
options = options.merge(:_recall => recall)

👮 rubocop doesn't seem to like this

This comment has been minimized.

Copy link
@jonathanhefner

jonathanhefner May 20, 2020

Member

@alipman88 Fixed by #39360. 👍

This comment has been minimized.

Copy link
@kaspth

kaspth May 20, 2020

Contributor

Just fixed in #39360, thanks!

This comment has been minimized.

Copy link
@jonathanhefner

jonathanhefner May 20, 2020

Member

@kaspth Quick draw at the (Rubocop is) O.K. Corral!

This comment has been minimized.

Copy link
@kaspth

kaspth May 20, 2020

Contributor

panting-spongebob

This comment has been minimized.

Copy link
@tenderlove

tenderlove May 20, 2020

Author Member

Sorry!!!

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)
Expand Down

0 comments on commit c34b6b0

Please sign in to comment.