diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-11-19 16:24:28 +0530 |
---|---|---|
committer | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-11-19 16:24:28 +0530 |
commit | b945c9ad62a0c14fffda8f08d6cf3fdc1141e3a9 (patch) | |
tree | 1a50d6680e65e9e3398bf55cba28395a59f10f29 | |
parent | ff2fe014d916a2f7c4330ca7208a857bd0ef8992 (diff) | |
download | rails-b945c9ad62a0c14fffda8f08d6cf3fdc1141e3a9.tar.gz rails-b945c9ad62a0c14fffda8f08d6cf3fdc1141e3a9.tar.bz2 rails-b945c9ad62a0c14fffda8f08d6cf3fdc1141e3a9.zip |
Add missing test for singular resource output in rake routes
- This test was present in https://github.com/rails/rails/pull/27089
but not present on master, may be removed in merge commit?
- There was discussion about moving this to `application/rake_test` so
may be this happened in merge commit.
- https://github.com/rails/rails/pull/27089#discussion_r88731157
-rw-r--r-- | railties/test/application/rake_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 1288d43231..cd09270df1 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -174,6 +174,26 @@ module ApplicationTests assert_equal expected_output, output end + def test_singular_resource_output_in_rake_routes + app_file "config/routes.rb", <<-RUBY + Rails.application.routes.draw do + resource :post + end + RUBY + + expected_output = [" Prefix Verb URI Pattern Controller#Action", + " new_post GET /post/new(.:format) posts#new", + "edit_post GET /post/edit(.:format) posts#edit", + " post GET /post(.:format) posts#show", + " PATCH /post(.:format) posts#update", + " PUT /post(.:format) posts#update", + " DELETE /post(.:format) posts#destroy", + " POST /post(.:format) posts#create\n"].join("\n") + + output = Dir.chdir(app_path) { `bin/rails routes -c PostController` } + assert_equal expected_output, output + end + def test_rails_routes_with_global_search_key app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do |