Permalink
Browse files

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.
  • Loading branch information...
eileencodes committed Apr 28, 2017
1 parent 265a866 commit 6e3c3e4e1dfb32e08060f8b607bf03c697b48ee5
Showing with 5 additions and 5 deletions.
  1. +5 −5 guides/source/testing.md
View
@@ -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
```

0 comments on commit 6e3c3e4

Please sign in to comment.