|
2 | 2 |
|
3 | 3 | require "abstract_unit"
|
4 | 4 |
|
5 |
| -module ActionController |
6 |
| - class Base |
7 |
| - include ActionController::Testing |
8 |
| - end |
9 |
| -end |
10 |
| - |
11 | 5 | class InfoControllerTest < ActionController::TestCase
|
| 6 | + include ActiveSupport::Testing::Isolation |
12 | 7 | tests Rails::InfoController
|
13 |
| - Rails.application.config.secret_key_base = "b3c631c314c0bbca50c1b2843150fe33" |
14 | 8 |
|
15 | 9 | def setup
|
| 10 | + ActionController::Base.include ActionController::Testing |
| 11 | + |
16 | 12 | Rails.application.routes.draw do
|
17 | 13 | namespace :test do
|
18 | 14 | get :nested_route, to: "test#show"
|
@@ -70,6 +66,26 @@ def fuzzy_results
|
70 | 66 | assert_response :success
|
71 | 67 | end
|
72 | 68 |
|
| 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 | + |
73 | 89 | test "info controller search returns exact matches for route names" do
|
74 | 90 | get :routes, params: { query: "rails_info_" }
|
75 | 91 | assert exact_results.size == 0, "should not match incomplete route names"
|
|
0 commit comments