aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/testing.md
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2017-04-28 08:56:43 -0700
committereileencodes <eileencodes@gmail.com>2017-05-14 09:03:33 -0400
commitc4c48b0d2a3df706b720a1aaf2986b61bdfb2ec2 (patch)
tree4c4f26b3c7607968b8cdebbaaff9981771900524 /guides/source/testing.md
parent5bb1ab4adee636e1accaeedcfc7c9aad5a3b2fa1 (diff)
downloadrails-c4c48b0d2a3df706b720a1aaf2986b61bdfb2ec2.tar.gz
rails-c4c48b0d2a3df706b720a1aaf2986b61bdfb2ec2.tar.bz2
rails-c4c48b0d2a3df706b720a1aaf2986b61bdfb2ec2.zip
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.
Diffstat (limited to 'guides/source/testing.md')
-rw-r--r--guides/source/testing.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md
index ced88e888c..e528b2e2a2 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -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
```