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:
parent
5bb1ab4ade
commit
c4c48b0d2a
1 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue