diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-21 22:57:14 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-21 22:57:14 +0300 |
commit | 7ff0c8ae57e6a88c86afae4f8e08bfacfb34d761 (patch) | |
tree | 9d9d003616b9b010697eb63ccde941e075c3e96c /doc/development | |
parent | 1f4e5fe7b191211520f2a0f415a34dac641326a7 (diff) | |
parent | b85b6590e50ac8ae6fa2fda64a58dc83f6ca615f (diff) |
Merge branch 'ce-9858-follow-up-on-a-bug-that-happens-when-using-a-factory-built-object-in-the-where-block-of-rspec-parameterized-tablesyntax' into 'master'
Fix and document an RSpec::Parameterized::TableSyntax edge-case
See merge request gitlab-org/gitlab-ce!25438
Diffstat (limited to 'doc/development')
-rw-r--r-- | doc/development/testing_guide/best_practices.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 4cc3812b0f0..2c8d488877b 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -358,16 +358,11 @@ range of inputs, might look like this: describe "#==" do using RSpec::Parameterized::TableSyntax - let(:project1) { create(:project) } - let(:project2) { create(:project) } where(:a, :b, :result) do 1 | 1 | true 1 | 2 | false true | true | true true | false | false - project1 | project1 | true - project2 | project2 | true - project 1 | project2 | false end with_them do @@ -380,6 +375,11 @@ describe "#==" do end ``` +CAUTION: **Caution:** +Only use simple values as input in the `where` block. Using procs, stateful +objects, FactoryBot-created objects etc. can lead to +[unexpected results](https://github.com/tomykaira/rspec-parameterized/issues/8). + ### Prometheus tests Prometheus metrics may be preserved from one test run to another. To ensure that metrics are |