diff options
author | eileencodes <eileencodes@gmail.com> | 2015-12-13 21:24:40 -0500 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2015-12-13 21:24:40 -0500 |
commit | 2dd64a7bbb0cb7b65976cb0516d0f338b099a715 (patch) | |
tree | b98866b4907df6b988b7183474f732cf724a369c /railties/lib | |
parent | 0b224ddd552dbe87280dfdd1eb7a8f25d7d4e062 (diff) | |
download | rails-2dd64a7bbb0cb7b65976cb0516d0f338b099a715.tar.gz rails-2dd64a7bbb0cb7b65976cb0516d0f338b099a715.tar.bz2 rails-2dd64a7bbb0cb7b65976cb0516d0f338b099a715.zip |
Revert "Merge pull request #22569 from seuros/remove-test-case"
This reverts commit 9712a7a12b7f9e4dcef751ceda8a73c3f4beb11f, reversing
changes made to 3e65c3d3886336e9145438cdeacaf4ebec6a48b8.
Reverting because this caused test failures and while we have a followup
branch there is still one failure that happens randomly and isn't
straight forward to fix.
Diffstat (limited to 'railties/lib')
3 files changed, 16 insertions, 17 deletions
diff --git a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb index 62c7e2f011..5a8a3ca5e0 100644 --- a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb +++ b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb @@ -1,7 +1,7 @@ require 'test_helper' <% module_namespacing do -%> -class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest +class <%= class_name %>ControllerTest < ActionController::TestCase <% if mountable_engine? -%> setup do @routes = Engine.routes @@ -15,7 +15,7 @@ class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest <% else -%> <% actions.each do |action| -%> test "should get <%= action %>" do - get url_for(action: :<%= action %>) + get :<%= action %> assert_response :success end diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb index 412ecb8db1..f302cd6c3d 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb @@ -1,7 +1,7 @@ require 'test_helper' <% module_namespacing do -%> -class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest +class <%= controller_class_name %>ControllerTest < ActionController::TestCase setup do @<%= singular_table_name %> = <%= fixture_name %>(:one) <% if mountable_engine? -%> @@ -10,31 +10,31 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end test "should get index" do - get url_for( controller: :<%= controller_name %>, action: :index ) + get :index assert_response :success end test "should create <%= singular_table_name %>" do assert_difference('<%= class_name %>.count') do - post url_for( controller: :<%= controller_name %>, action: :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %> ) + post :create, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> } end assert_response 201 end test "should show <%= singular_table_name %>" do - get url_for( controller: :<%= controller_name %>, action: :show, id: <%= "@#{singular_table_name}" %> ) + get :show, params: { id: <%= "@#{singular_table_name}" %> } assert_response :success end test "should update <%= singular_table_name %>" do - patch url_for( controller: :<%= controller_name %>, action: :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> ) + patch :update, params: { id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> } assert_response 200 end test "should destroy <%= singular_table_name %>" do assert_difference('<%= class_name %>.count', -1) do - delete url_for( controller: :<%= controller_name %>, action: :destroy, id: <%= "@#{singular_table_name}" %> ) + delete :destroy, params: { id: <%= "@#{singular_table_name}" %> } end assert_response 204 diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb index 3ac0b611ac..50b98b2631 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb @@ -1,51 +1,50 @@ require 'test_helper' <% module_namespacing do -%> -class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTest +class <%= controller_class_name %>ControllerTest < ActionController::TestCase setup do @<%= singular_table_name %> = <%= fixture_name %>(:one) <% if mountable_engine? -%> - @routes = Engine.routes <% end -%> end test "should get index" do - get url_for( controller: :<%= controller_name %>, action: :index ) + get :index assert_response :success end test "should get new" do - get url_for( controller: :<%= controller_name %>, action: :new ) + get :new assert_response :success end test "should create <%= singular_table_name %>" do assert_difference('<%= class_name %>.count') do - post url_for( controller: :<%= controller_name %>, action: :create, <%= "#{singular_table_name}: { #{attributes_hash} }" %> ) + post :create, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> } end assert_redirected_to <%= singular_table_name %>_path(<%= class_name %>.last) end test "should show <%= singular_table_name %>" do - get url_for( controller: :<%= controller_name %>, action: :show, id: <%= "@#{singular_table_name}" %> ) + get :show, params: { id: <%= "@#{singular_table_name}" %> } assert_response :success end test "should get edit" do - get url_for( controller: :<%= controller_name %>, action: :edit, id: <%= "@#{singular_table_name}" %> ) + get :edit, params: { id: <%= "@#{singular_table_name}" %> } assert_response :success end test "should update <%= singular_table_name %>" do - patch url_for( controller: :<%= controller_name %>, action: :update, id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> ) + patch :update, params: { id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> } assert_redirected_to <%= singular_table_name %>_path(<%= "@#{singular_table_name}" %>) end test "should destroy <%= singular_table_name %>" do assert_difference('<%= class_name %>.count', -1) do - delete url_for( controller: :<%= controller_name %>, action: :destroy, id: <%= "@#{singular_table_name}" %> ) + delete :destroy, params: { id: <%= "@#{singular_table_name}" %> } end assert_redirected_to <%= index_helper %>_path |