Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/banzai/filter/inline_observability_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/inline_observability_filter_spec.rb48
1 files changed, 35 insertions, 13 deletions
diff --git a/spec/lib/banzai/filter/inline_observability_filter_spec.rb b/spec/lib/banzai/filter/inline_observability_filter_spec.rb
index 341ada6d2b5..fb1ba46e76c 100644
--- a/spec/lib/banzai/filter/inline_observability_filter_spec.rb
+++ b/spec/lib/banzai/filter/inline_observability_filter_spec.rb
@@ -7,27 +7,49 @@ RSpec.describe Banzai::Filter::InlineObservabilityFilter do
let(:input) { %(<a href="#{url}">example</a>) }
let(:doc) { filter(input) }
+ let(:group) { create(:group) }
+ let(:user) { create(:user) }
- context 'when the document has an external link' do
- let(:url) { 'https://foo.com' }
+ describe '#filter?' do
+ context 'when the document has an external link' do
+ let(:url) { 'https://foo.com' }
- it 'leaves regular non-observability links unchanged' do
- expect(doc.to_s).to eq(input)
+ it 'leaves regular non-observability links unchanged' do
+ expect(doc.to_s).to eq(input)
+ end
end
- end
- context 'when the document contains an embeddable observability link' do
- let(:url) { 'https://observe.gitlab.com/12345' }
+ context 'when the document contains an embeddable observability link' do
+ let(:url) { 'https://observe.gitlab.com/12345' }
+
+ it 'leaves the original link unchanged' do
+ expect(doc.at_css('a').to_s).to eq(input)
+ end
+
+ it 'appends an observability charts placeholder' do
+ node = doc.at_css('.js-render-observability')
- it 'leaves the original link unchanged' do
- expect(doc.at_css('a').to_s).to eq(input)
+ expect(node).to be_present
+ expect(node.attribute('data-frame-url').to_s).to eq(url)
+ end
end
- it 'appends a observability charts placeholder' do
- node = doc.at_css('.js-render-observability')
+ context 'when feature flag is disabled' do
+ let(:url) { 'https://observe.gitlab.com/12345' }
+
+ before do
+ stub_feature_flags(observability_group_tab: false)
+ end
+
+ it 'leaves the original link unchanged' do
+ expect(doc.at_css('a').to_s).to eq(input)
+ end
+
+ it 'does not append an observability charts placeholder' do
+ node = doc.at_css('.js-render-observability')
- expect(node).to be_present
- expect(node.attribute('data-frame-url').to_s).to eq(url)
+ expect(node).not_to be_present
+ end
end
end
end