diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2015-05-02 10:45:54 +0530 |
---|---|---|
committer | Prathamesh Sonpatki <csonpatki@gmail.com> | 2015-05-02 12:31:05 +0530 |
commit | 462094dbea73dcdc4be621df96ac674ec21dfe7b (patch) | |
tree | 3440f0eb325b595307e9c381a2786d357d4938b3 /railties/lib/rails/generators/test_unit | |
parent | 79c4aac5525b950676ef1e859f85c6d18e8a2be3 (diff) | |
download | rails-462094dbea73dcdc4be621df96ac674ec21dfe7b.tar.gz rails-462094dbea73dcdc4be621df96ac674ec21dfe7b.tar.bz2 rails-462094dbea73dcdc4be621df96ac674ec21dfe7b.zip |
Removed `assigns` from functional_test templates
- Based on DHH's suggestion about deprecating `assigns` in
https://github.com/rails/rails/pull/18305#issuecomment-68605166.
Diffstat (limited to 'railties/lib/rails/generators/test_unit')
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb | 5 |
1 files changed, 2 insertions, 3 deletions
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 8d825ae7b0..76313575e9 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 @@ -9,7 +9,6 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success - assert_not_nil assigns(:<%= table_name %>) end test "should get new" do @@ -22,7 +21,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase post :create, params: { <%= "#{singular_table_name}: { #{attributes_hash} }" %> } end - assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) + assert_redirected_to <%= singular_table_name %>_path(<%= class_name %>.last) end test "should show <%= singular_table_name %>" do @@ -37,7 +36,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase test "should update <%= singular_table_name %>" do patch :update, params: { id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> } - assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>)) + assert_redirected_to <%= singular_table_name %>_path(<%= "@#{singular_table_name}" %>) end test "should destroy <%= singular_table_name %>" do |