diff --git a/guides/source/testing.md b/guides/source/testing.md index 20de4d815d..cffe52d998 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -913,7 +913,7 @@ You can also run `bin/rails test:all` to run all tests, including system tests. Now let's test the flow for creating a new article in our blog. ```ruby -test "creating an article" do +test "should create Article" do visit articles_path click_on "New Article" diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 1b3e59aabd..157e70040b 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,11 @@ +* Modified scaffold generator template so that running + `rails g scaffold Author` no longer generates tests called "creating + a Author", "updating a Author", and "destroying a Author" + + Fixes #40744. + + *Michael Duchemin* + * Raise an error in generators if a field type is invalid. *Petrik de Heus* diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt b/railties/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt index 4f5bbf1108..23838a432e 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt @@ -11,7 +11,7 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase assert_selector "h1", text: "<%= class_name.pluralize.titleize %>" end - test "creating a <%= human_name %>" do + test "should create <%= human_name %>" do visit <%= plural_table_name %>_url click_on "New <%= class_name.titleize %>" @@ -28,7 +28,7 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase click_on "Back" end - test "updating a <%= human_name %>" do + test "should update <%= human_name %>" do visit <%= plural_table_name %>_url click_on "Edit", match: :first @@ -45,7 +45,7 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase click_on "Back" end - test "destroying a <%= human_name %>" do + test "should destroy <%= human_name %>" do visit <%= plural_table_name %>_url page.accept_confirm do click_on "Destroy", match: :first