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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 21:14:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 21:14:27 +0300
commitf6c037b73c90ac251625c17720e6b8307c1698cc (patch)
tree26a287a09ae414da75f7e383dd1eaae5d3704ca5 /spec/lib/sidebars
parentbf0d6692fc4c16205cc49b8b87b7b7e0daa97c63 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/sidebars')
-rw-r--r--spec/lib/sidebars/projects/menus/shimo_menu_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/lib/sidebars/projects/menus/shimo_menu_spec.rb b/spec/lib/sidebars/projects/menus/shimo_menu_spec.rb
new file mode 100644
index 00000000000..534267a329e
--- /dev/null
+++ b/spec/lib/sidebars/projects/menus/shimo_menu_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Sidebars::Projects::Menus::ShimoMenu do
+ let_it_be_with_reload(:project) { create(:project) }
+
+ let(:context) { Sidebars::Projects::Context.new(current_user: project.owner, container: project) }
+
+ subject(:shimo_menu) { described_class.new(context) }
+
+ describe '#render?' do
+ context 'without a valid Shimo integration' do
+ it "doesn't render the menu" do
+ expect(shimo_menu.render?).to be_falsey
+ end
+ end
+
+ context 'with a valid Shimo integration' do
+ let_it_be_with_reload(:shimo_integration) { create(:shimo_integration, project: project) }
+
+ context 'when integration is active' do
+ it 'renders the menu' do
+ expect(shimo_menu.render?).to eq true
+ end
+
+ it 'renders menu link' do
+ expected_url = Rails.application.routes.url_helpers.project_integrations_shimo_path(project)
+ expect(shimo_menu.link).to eq expected_url
+ end
+ end
+
+ context 'when integration is inactive' do
+ before do
+ shimo_integration.update!(active: false)
+ end
+
+ it "doesn't render the menu" do
+ expect(shimo_menu.render?).to eq false
+ end
+ end
+ end
+ end
+end