1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Clean up RoutesTest a bit

* Remove unused require
* Remove redundant `test`
* Change `rake` to `rails`
This commit is contained in:
yuuji.yaginuma 2018-03-01 20:44:05 +09:00
parent c9fa561b2e
commit 90de2dc6f2

View file

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "isolation/abstract_unit" require "isolation/abstract_unit"
require "env_helpers"
require "rails/command" require "rails/command"
require "rails/commands/routes/routes_command" require "rails/commands/routes/routes_command"
@ -9,7 +8,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
setup :build_app setup :build_app
teardown :teardown_app teardown :teardown_app
test "test singular resource output in rake routes" do test "singular resource output in rails routes" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
resource :post resource :post
@ -29,7 +28,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
assert_equal expected_output, output assert_equal expected_output, output
end end
test "test rails routes with global search key" do test "rails routes with global search key" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
get '/cart', to: 'cart#show' get '/cart', to: 'cart#show'
@ -60,7 +59,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
"basketballs GET /basketballs(.:format) basketball#index\n", output "basketballs GET /basketballs(.:format) basketball#index\n", output
end end
test "test rails routes with controller search_key" do test "rails routes with controller search key" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
get '/cart', to: 'cart#show' get '/cart', to: 'cart#show'
@ -78,7 +77,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output assert_equal "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n", output
end end
test "test rails routes with namespaced controller search key" do test "rails routes with namespaced controller search key" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :admin do namespace :admin do
@ -102,7 +101,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
assert_equal expected_output, output assert_equal expected_output, output
end end
test "test rails routes displays message when no routes are defined" do test "rails routes displays message when no routes are defined" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
end end
@ -119,7 +118,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
MESSAGE MESSAGE
end end
test "test rails routes with expanded option" do test "rails routes with expanded option" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
get '/cart', to: 'cart#show' get '/cart', to: 'cart#show'
@ -167,7 +166,6 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
end end
private private
def run_routes_command(args = []) def run_routes_command(args = [])
rails "routes", args rails "routes", args
end end