diff options
Diffstat (limited to 'spec/support/shared_examples/evidence_updated_exposed_fields.rb')
-rw-r--r-- | spec/support/shared_examples/evidence_updated_exposed_fields.rb | 29 |
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 |