diff options
Diffstat (limited to 'railties/test/rails_info_controller_test.rb')
-rw-r--r-- | railties/test/rails_info_controller_test.rb | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index c51503c2b7..d795629ccd 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" module ActionController class Base @@ -11,8 +11,8 @@ class InfoControllerTest < ActionController::TestCase def setup Rails.application.routes.draw do - get '/rails/info/properties' => "rails/info#properties" - get '/rails/info/routes' => "rails/info#routes" + get "/rails/info/properties" => "rails/info#properties" + get "/rails/info/routes" => "rails/info#routes" end @routes = Rails.application.routes @@ -30,7 +30,7 @@ class InfoControllerTest < ActionController::TestCase test "info controller renders an error message when request was forbidden" do @request.env["REMOTE_ADDR"] = "example.org" get :properties - assert_select 'p' + assert_select "p" end test "info controller allows requests when all requests are considered local" do @@ -45,7 +45,7 @@ class InfoControllerTest < ActionController::TestCase test "info controller renders a table with properties" do get :properties - assert_select 'table' + assert_select "table" end test "info controller renders with routes" do @@ -54,28 +54,34 @@ class InfoControllerTest < ActionController::TestCase end test "info controller returns exact matches" do - exact_count = -> { JSON(response.body)['exact'].size } + exact_count = -> { JSON(response.body)["exact"].size } - get :routes, params: { path: 'rails/info/route' } - assert exact_count.call == 0, 'should not match incomplete routes' + get :routes, params: { path: "rails/info/route" } + assert exact_count.call == 0, "should not match incomplete routes" - get :routes, params: { path: 'rails/info/routes' } - assert exact_count.call == 1, 'should match complete routes' + get :routes, params: { path: "rails/info/routes" } + assert exact_count.call == 1, "should match complete routes" - get :routes, params: { path: 'rails/info/routes.html' } - assert exact_count.call == 1, 'should match complete routes with optional parts' + get :routes, params: { path: "rails/info/routes.html" } + assert exact_count.call == 1, "should match complete routes with optional parts" end test "info controller returns fuzzy matches" do - fuzzy_count = -> { JSON(response.body)['fuzzy'].size } + fuzzy_count = -> { JSON(response.body)["fuzzy"].size } - get :routes, params: { path: 'rails/info' } - assert fuzzy_count.call == 2, 'should match incomplete routes' + get :routes, params: { path: "rails/info" } + assert fuzzy_count.call == 2, "should match incomplete routes" - get :routes, params: { path: 'rails/info/routes' } - assert fuzzy_count.call == 1, 'should match complete routes' + get :routes, params: { path: "rails/info/routes" } + assert fuzzy_count.call == 1, "should match complete routes" - get :routes, params: { path: 'rails/info/routes.html' } - assert fuzzy_count.call == 0, 'should match optional parts of route literally' + get :routes, params: { path: "rails/info/routes.html" } + assert fuzzy_count.call == 0, "should match optional parts of route literally" + end + + test "internal routes do not have a default params[:internal] value" do + get :properties + assert_response :success + assert_nil @controller.params[:internal] end end |