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

Use a more realistic use-case for system test generator

It's more likely you'll generate a test for testing users than a users
creates test. This is a better example of a real world test.
Additionally the users create view is unlikely to have the text
"UserCreates" since that is likely generated as well. This is now an
example of visiting the users index.
This commit is contained in:
eileencodes 2017-04-28 08:56:43 -07:00
parent 5bb1ab4ade
commit c4c48b0d2a

View file

@ -610,9 +610,9 @@ For creating Rails system tests, you use the `test/system` directory in your
application. Rails provides a generator to create a system test skeleton for you.
```bash
$ bin/rails generate system_test users_create
$ bin/rails generate system_test users
invoke test_unit
create test/system/users_creates_test.rb
create test/system/users_test.rb
```
Here's what a freshly-generated system test looks like:
@ -620,11 +620,11 @@ Here's what a freshly-generated system test looks like:
```ruby
require "application_system_test_case"
class UsersCreatesTest < ApplicationSystemTestCase
class UsersTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit users_creates_url
# visit users_url
#
# assert_selector "h1", text: "UsersCreate"
# assert_selector "h1", text: "Users"
# end
end
```