From 98a039dcd987fd3a8c2c0cbd527c71ac3ffaaf06 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Tue, 27 Oct 2015 00:41:27 +0000 Subject: Update test generators to use ActionDispatch::IntegrationTest In Rails 5.1 `ActionController::TestCase` will be moved out of Rails into it's own gem. Please use `ActionDispatch::IntegrationTest` going forward. This changes the generators to use `ActionDispatch::IntegrationTest` and the required URL setup (rather than symbols) for each of the controller actions. Updated fix to #22076. --- railties/lib/rails/generators/named_base.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'railties/lib/rails/generators/named_base.rb') diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 243694f38e..658d883883 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -129,6 +129,18 @@ module Rails uncountable? ? "#{plural_table_name}_index" : plural_table_name end + def show_helper + "#{singular_table_name}_url(@#{singular_table_name})" + end + + def edit_helper + "edit_#{show_helper}" + end + + def new_helper + "new_#{singular_table_name}_url" + end + def singular_table_name @singular_table_name ||= (pluralize_table_names? ? table_name.singularize : table_name) end -- cgit v1.2.3