diff options
author | Rémy Coutable <remy@rymai.me> | 2019-02-20 19:51:26 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-02-20 19:51:26 +0100 |
commit | b85b6590e50ac8ae6fa2fda64a58dc83f6ca615f (patch) | |
tree | 6784f025b4aaf63c15ac377d9c89c83cb18058e9 /doc | |
parent | e0fc809b2697d06cb89e9d6acbb9339e36ef59e7 (diff) | |
download | gitlab-ce-b85b6590e50ac8ae6fa2fda64a58dc83f6ca615f.tar.gz |
Fix and document an RSpec::Parameterized::TableSyntax edge-case
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'doc')
-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 |