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 16:16:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 16:16:36 +0300
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/models/integrations/shimo_spec.rb
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/models/integrations/shimo_spec.rb')
-rw-r--r--spec/models/integrations/shimo_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/models/integrations/shimo_spec.rb b/spec/models/integrations/shimo_spec.rb
new file mode 100644
index 00000000000..25df8d2b249
--- /dev/null
+++ b/spec/models/integrations/shimo_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe ::Integrations::Shimo do
+ describe '#fields' do
+ let(:shimo_integration) { create(:shimo_integration) }
+
+ it 'returns custom fields' do
+ expect(shimo_integration.fields.pluck(:name)).to eq(%w[external_wiki_url])
+ end
+ end
+
+ describe '#create' do
+ let(:project) { create(:project, :repository) }
+ let(:external_wiki_url) { 'https://shimo.example.com/desktop' }
+ let(:params) { { active: true, project: project, external_wiki_url: external_wiki_url } }
+
+ context 'with valid params' do
+ it 'creates the Shimo integration' do
+ shimo = described_class.create!(params)
+
+ expect(shimo.valid?).to be true
+ expect(shimo.render?).to be true
+ expect(shimo.external_wiki_url).to eq(external_wiki_url)
+ end
+ end
+
+ context 'with invalid params' do
+ it 'cannot create the Shimo integration without external_wiki_url' do
+ params['external_wiki_url'] = nil
+ expect { described_class.create!(params) }.to raise_error(ActiveRecord::RecordInvalid)
+ end
+
+ it 'cannot create the Shimo integration with invalid external_wiki_url' do
+ params['external_wiki_url'] = 'Fake Invalid URL'
+ expect { described_class.create!(params) }.to raise_error(ActiveRecord::RecordInvalid)
+ end
+ end
+ end
+end