aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2018-10-05 17:12:19 -0400
committerGitHub <noreply@github.com>2018-10-05 17:12:19 -0400
commited744a159fec1f8919ddf9f2874f3d7eed8e5a70 (patch)
tree436107b1e0ee8e2af69fc9557cf47e50760526c7 /guides
parentc9e0a61db11b254d63169149fec5a263caa669db (diff)
parent899334b5b3a64e4563219d9fe1b923e9033beb3f (diff)
downloadrails-ed744a159fec1f8919ddf9f2874f3d7eed8e5a70.tar.gz
rails-ed744a159fec1f8919ddf9f2874f3d7eed8e5a70.tar.bz2
rails-ed744a159fec1f8919ddf9f2874f3d7eed8e5a70.zip
Merge pull request #34103 from albertoalmagro/guides-running-test-with-seed
Add documentation to run tests with specific seed [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/contributing_to_ruby_on_rails.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 01848bdc11..1beadd78d6 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