summaryrefslogtreecommitdiff
path: root/spec/helpers/preferences_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/preferences_helper_spec.rb')
-rw-r--r--spec/helpers/preferences_helper_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb
index 6be6d3670d4..ad2f142e3ff 100644
--- a/spec/helpers/preferences_helper_spec.rb
+++ b/spec/helpers/preferences_helper_spec.rb
@@ -143,4 +143,41 @@ RSpec.describe PreferencesHelper do
.and_return(double('user', messages))
end
end
+
+ describe '#integration_views' do
+ let(:gitpod_url) { 'http://gitpod.test' }
+
+ before do
+ allow(Gitlab::CurrentSettings).to receive(:gitpod_enabled).and_return(gitpod_enabled)
+ allow(Gitlab::CurrentSettings).to receive(:gitpod_url).and_return(gitpod_url)
+ end
+
+ context 'when Gitpod is not enabled' do
+ let(:gitpod_enabled) { false }
+
+ it 'does not include Gitpod integration' do
+ expect(helper.integration_views).to be_empty
+ end
+ end
+
+ context 'when Gitpod is enabled' do
+ let(:gitpod_enabled) { true }
+
+ it 'includes Gitpod integration' do
+ expect(helper.integration_views[0][:name]).to eq 'gitpod'
+ end
+
+ it 'returns the Gitpod url configured in settings' do
+ expect(helper.integration_views[0][:message_url]).to eq gitpod_url
+ end
+
+ context 'when Gitpod url is not set' do
+ let(:gitpod_url) { '' }
+
+ it 'returns the Gitpod default url' do
+ expect(helper.integration_views[0][:message_url]).to eq 'https://gitpod.io/'
+ end
+ end
+ end
+ end
end