aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/contributing_to_ruby_on_rails.md
diff options
context:
space:
mode:
authorWillian Gustavo Veiga <beberveiga@gmail.com>2018-10-11 07:44:27 -0300
committerWillian Gustavo Veiga <beberveiga@gmail.com>2018-10-11 07:44:27 -0300
commit99bd626885b72acd44861727918ee107a649e2b4 (patch)
tree6d59fcdb226a65d9eb63f8bad2b2df7b09b92a60 /guides/source/contributing_to_ruby_on_rails.md
parent4b60e34f58c0dabe18a793038fc7775d044016f6 (diff)
parent6a278c6e9a05b0d901e482458cfc2e3df587d522 (diff)
downloadrails-99bd626885b72acd44861727918ee107a649e2b4.tar.gz
rails-99bd626885b72acd44861727918ee107a649e2b4.tar.bz2
rails-99bd626885b72acd44861727918ee107a649e2b4.zip
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'guides/source/contributing_to_ruby_on_rails.md')
-rw-r--r--guides/source/contributing_to_ruby_on_rails.md33
1 files changed, 27 insertions, 6 deletions
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 01848bdc11..ed47a0de0f 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -336,6 +336,26 @@ $ bundle exec ruby -w -Itest test/mail_layout_test.rb -n test_explicit_class_lay
The `-n` option allows you to run a single method instead of the whole
file.
+#### Running tests with a specific seed
+
+Test execution is randomized with a randomization seed. If you are experiencing random
+test failures you can more accurately reproduce a failing test scenario by specifically
+setting the randomization seed.
+
+Running all tests for a component:
+
+```bash
+$ cd actionmailer
+$ SEED=15002 bundle exec rake test
+```
+
+Running a single test file:
+
+```bash
+$ cd actionmailer
+$ SEED=15002 bundle exec ruby -w -Itest test/mail_layout_test.rb
+```
+
#### Testing Active Record
First, create the databases you'll need. You can find a list of the required
@@ -576,13 +596,13 @@ $ git rebase -i rails/master
< Choose 'squash' for all of your commits except the first one. >
< Edit the commit message to make sense, and describe all your changes. >
-$ git push fork my_new_branch -f
+$ git push fork my_new_branch --force-with-lease
```
You should be able to refresh the pull request on GitHub and see that it has
been updated.
-#### Updating pull request
+#### Updating a pull request
Sometimes you will be asked to make some changes to the code you have
already committed. This can include amending existing commits. In this
@@ -592,12 +612,13 @@ you can force push to your branch on GitHub as described earlier in
squashing commits section:
```bash
-$ git push fork my_new_branch -f
+$ git push fork my_new_branch --force-with-lease
```
-This will update the branch and pull request on GitHub with your new code. Do
-note that using force push may result in commits being lost on the remote branch; use it with care.
-
+This will update the branch and pull request on GitHub with your new code.
+By force pushing with `--force-with-lease`, git will more safely update
+the remote than with a typical `-f`, which can delete work from the remote
+that you don't already have.
### Older Versions of Ruby on Rails