Skip to content

Commit

Permalink
Use a more realistic use-case for system test generator
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eileencodes committed May 14, 2017
1 parent 265a866 commit 6e3c3e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions guides/source/testing.md
Expand Up @@ -610,21 +610,21 @@ 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:

```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
```
Expand Down

0 comments on commit 6e3c3e4

Please sign in to comment.