1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix system test scaffold generator for vowels

Fix issue where running "rails g scaffold Author" will create system
test names like "creating a Author" and "updating a Author" so that
there are not grammatical errors. Now running "rails g scaffold Author"
will generate "should create Author", "should update Author", and
"should destroy Author" which works around the article vowel-sound
agreement issues.

Fixes #40744
This commit is contained in:
Michael Duchemin 2020-12-09 19:37:45 -05:00
parent 46337faa79
commit 9fee1f36dc
No known key found for this signature in database
GPG key ID: 80DBC88807D13C3B
3 changed files with 12 additions and 4 deletions

View file

@ -864,7 +864,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"

View file

@ -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*
* Add benchmark method that can be called from anywhere.
This method is used as a quick way to measure & log the speed of some code.

View file

@ -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