summaryrefslogtreecommitdiff
path: root/spec/models/integrations/field_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/models/integrations/field_spec.rb
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
downloadgitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/models/integrations/field_spec.rb')
-rw-r--r--spec/models/integrations/field_spec.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/models/integrations/field_spec.rb b/spec/models/integrations/field_spec.rb
index c8caf831191..6b1ce7fcbde 100644
--- a/spec/models/integrations/field_spec.rb
+++ b/spec/models/integrations/field_spec.rb
@@ -5,7 +5,14 @@ require 'spec_helper'
RSpec.describe ::Integrations::Field do
subject(:field) { described_class.new(**attrs) }
- let(:attrs) { { name: nil } }
+ let(:attrs) { { name: nil, integration_class: test_integration } }
+ let(:test_integration) do
+ Class.new(Integration) do
+ def self.default_placeholder
+ 'my placeholder'
+ end
+ end
+ end
describe '#name' do
before do
@@ -68,11 +75,8 @@ RSpec.describe ::Integrations::Field do
end
context 'when set to a dynamic value' do
- before do
- attrs[name] = -> { Time.current }
- end
-
it 'is computed' do
+ attrs[name] = -> { Time.current }
start = Time.current
travel_to(start + 1.minute) do
@@ -80,6 +84,13 @@ RSpec.describe ::Integrations::Field do
expect(field.send(name)).to be_after(start)
end
end
+
+ it 'is executed in the class scope' do
+ attrs[name] = -> { default_placeholder }
+
+ expect(field[name]).to eq('my placeholder')
+ expect(field.send(name)).to eq('my placeholder')
+ end
end
end
end