summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:06:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:06:17 +0000
commit238d22c07218adf2b8f3db630ee8b74ca6f29df5 (patch)
tree23fd5f85efef0fb95eb73bf6395d5b7e8c0f1b9f /spec/support
parent6b75320f525f841454f1ab162d141d3610f2e77b (diff)
downloadgitlab-ce-list.tar.gz
Add latest changes from gitlab-org/gitlab@masterlist
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/evidence_updated_exposed_fields.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/support/shared_examples/evidence_updated_exposed_fields.rb b/spec/support/shared_examples/evidence_updated_exposed_fields.rb
new file mode 100644
index 00000000000..2a02fdd7666
--- /dev/null
+++ b/spec/support/shared_examples/evidence_updated_exposed_fields.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+shared_examples 'updated exposed field' do
+ it 'creates another Evidence object' do
+ model.send("#{updated_field}=", updated_value)
+
+ expect(model.evidence_summary_keys).to include(updated_field)
+ expect { model.save! }.to change(Evidence, :count).by(1)
+ expect(updated_json_field).to eq(updated_value)
+ end
+end
+
+shared_examples 'updated non-exposed field' do
+ it 'does not create any Evidence object' do
+ model.send("#{updated_field}=", updated_value)
+
+ expect(model.evidence_summary_keys).not_to include(updated_field)
+ expect { model.save! }.not_to change(Evidence, :count)
+ end
+end
+
+shared_examples 'updated field on non-linked entity' do
+ it 'does not create any Evidence object' do
+ model.send("#{updated_field}=", updated_value)
+
+ expect(model.evidence_summary_keys).to be_empty
+ expect { model.save! }.not_to change(Evidence, :count)
+ end
+end