Skip to content

Commit a546cab

Browse files
authored
Merge pull request rails#52407 from Shopify/regression_for_52303
Add regression test for development routes source mapping
2 parents 097d0f1 + 2b5fdf5 commit a546cab

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

railties/test/rails_info_controller_test.rb

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
require "abstract_unit"
44

5-
module ActionController
6-
class Base
7-
include ActionController::Testing
8-
end
9-
end
10-
115
class InfoControllerTest < ActionController::TestCase
6+
include ActiveSupport::Testing::Isolation
127
tests Rails::InfoController
13-
Rails.application.config.secret_key_base = "b3c631c314c0bbca50c1b2843150fe33"
148

159
def setup
10+
ActionController::Base.include ActionController::Testing
11+
1612
Rails.application.routes.draw do
1713
namespace :test do
1814
get :nested_route, to: "test#show"
@@ -70,6 +66,26 @@ def fuzzy_results
7066
assert_response :success
7167
end
7268

69+
test "info controller routes shows source location" do
70+
Rails.env = "development"
71+
Rails.configuration.eager_load = false
72+
Rails.application.initialize!
73+
Rails.application.routes.draw do
74+
namespace :test do
75+
get :nested_route, to: "test#show"
76+
end
77+
get "/rails/info/routes" => "rails/info#routes"
78+
end
79+
80+
get :routes
81+
82+
assert_select("table tr") do
83+
assert_select("td", text: "test_nested_route_path")
84+
assert_select("td", text: "test/test#show")
85+
assert_select("td", text: "#{__FILE__}:75")
86+
end
87+
end
88+
7389
test "info controller search returns exact matches for route names" do
7490
get :routes, params: { query: "rails_info_" }
7591
assert exact_results.size == 0, "should not match incomplete route names"

0 commit comments

Comments
 (0)