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>2020-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/models/project_services
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/models/project_services')
-rw-r--r--spec/models/project_services/buildkite_service_spec.rb20
-rw-r--r--spec/models/project_services/gitlab_issue_tracker_service_spec.rb54
-rw-r--r--spec/models/project_services/jira_service_spec.rb2
-rw-r--r--spec/models/project_services/jira_tracker_data_spec.rb4
-rw-r--r--spec/models/project_services/microsoft_teams_service_spec.rb1
5 files changed, 25 insertions, 56 deletions
diff --git a/spec/models/project_services/buildkite_service_spec.rb b/spec/models/project_services/buildkite_service_spec.rb
index ff717a59e7b..3d0c2cc1006 100644
--- a/spec/models/project_services/buildkite_service_spec.rb
+++ b/spec/models/project_services/buildkite_service_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe BuildkiteService, :use_clean_rails_memory_store_caching do
project: project,
properties: {
service_hook: true,
- project_url: 'https://buildkite.com/account-name/example-project',
+ project_url: 'https://buildkite.com/organization-name/example-pipeline',
token: 'secret-sauce-webhook-token:secret-sauce-status-token'
}
)
@@ -45,11 +45,27 @@ RSpec.describe BuildkiteService, :use_clean_rails_memory_store_caching do
end
end
+ describe '.supported_events' do
+ it 'supports push, merge_request, and tag_push events' do
+ expect(service.supported_events).to eq %w(push merge_request tag_push)
+ end
+ end
+
describe 'commits methods' do
before do
allow(project).to receive(:default_branch).and_return('default-brancho')
end
+ it 'always activates SSL verification after saved' do
+ service.create_service_hook(enable_ssl_verification: false)
+
+ service.enable_ssl_verification = false
+ service.active = true
+
+ expect { service.save! }
+ .to change { service.service_hook.enable_ssl_verification }.from(false).to(true)
+ end
+
describe '#webhook_url' do
it 'returns the webhook url' do
expect(service.webhook_url).to eq(
@@ -69,7 +85,7 @@ RSpec.describe BuildkiteService, :use_clean_rails_memory_store_caching do
describe '#build_page' do
it 'returns the correct build page' do
expect(service.build_page('2ab7834c', nil)).to eq(
- 'https://buildkite.com/account-name/example-project/builds?commit=2ab7834c'
+ 'https://buildkite.com/organization-name/example-pipeline/builds?commit=2ab7834c'
)
end
end
diff --git a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb
deleted file mode 100644
index a6b7cb05836..00000000000
--- a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe GitlabIssueTrackerService do
- describe "Associations" do
- it { is_expected.to belong_to :project }
- it { is_expected.to have_one :service_hook }
- end
-
- describe 'Validations' do
- context 'when service is active' do
- subject { described_class.new(project: create(:project), active: true) }
-
- it { is_expected.to validate_presence_of(:issues_url) }
- it_behaves_like 'issue tracker service URL attribute', :issues_url
- end
-
- context 'when service is inactive' do
- subject { described_class.new(project: create(:project), active: false) }
-
- it { is_expected.not_to validate_presence_of(:issues_url) }
- end
- end
-
- describe 'project and issue urls' do
- let(:project) { create(:project) }
- let(:service) { project.create_gitlab_issue_tracker_service(active: true) }
-
- context 'with absolute urls' do
- before do
- allow(described_class).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
- end
-
- it 'gives the correct path' do
- expect(service.project_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues")
- expect(service.new_issue_url).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/new")
- expect(service.issue_url(432)).to eq("http://#{Gitlab.config.gitlab.host}/gitlab/root/#{project.full_path}/-/issues/432")
- end
- end
-
- context 'with relative urls' do
- before do
- allow(described_class).to receive(:default_url_options).and_return(script_name: "/gitlab/root")
- end
-
- it 'gives the correct path' do
- expect(service.issue_tracker_path).to eq("/gitlab/root/#{project.full_path}/-/issues")
- expect(service.new_issue_path).to eq("/gitlab/root/#{project.full_path}/-/issues/new")
- expect(service.issue_path(432)).to eq("/gitlab/root/#{project.full_path}/-/issues/432")
- end
- end
- end
-end
diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb
index cfc2c920cd2..28bba893be4 100644
--- a/spec/models/project_services/jira_service_spec.rb
+++ b/spec/models/project_services/jira_service_spec.rb
@@ -121,6 +121,7 @@ RSpec.describe JiraService do
{ url: url, api_url: api_url, username: username, password: password,
jira_issue_transition_id: transition_id }
end
+
let(:data_params) do
{
url: url, api_url: api_url,
@@ -562,6 +563,7 @@ RSpec.describe JiraService do
password: password
)
end
+
let(:jira_issue) { ExternalIssue.new('JIRA-123', project) }
subject { jira_service.create_cross_reference_note(jira_issue, resource, user) }
diff --git a/spec/models/project_services/jira_tracker_data_spec.rb b/spec/models/project_services/jira_tracker_data_spec.rb
index 9e38bced46c..f2e2fa65e93 100644
--- a/spec/models/project_services/jira_tracker_data_spec.rb
+++ b/spec/models/project_services/jira_tracker_data_spec.rb
@@ -8,4 +8,8 @@ RSpec.describe JiraTrackerData do
describe 'Associations' do
it { is_expected.to belong_to(:service) }
end
+
+ describe 'deployment_type' do
+ it { is_expected.to define_enum_for(:deployment_type).with_values([:unknown, :server, :cloud]).with_prefix(:deployment) }
+ end
end
diff --git a/spec/models/project_services/microsoft_teams_service_spec.rb b/spec/models/project_services/microsoft_teams_service_spec.rb
index 610feb52827..53ab63ef030 100644
--- a/spec/models/project_services/microsoft_teams_service_spec.rb
+++ b/spec/models/project_services/microsoft_teams_service_spec.rb
@@ -121,6 +121,7 @@ RSpec.describe MicrosoftTeamsService do
message: "user created page: Awesome wiki_page"
}
end
+
let(:wiki_page) { create(:wiki_page, wiki: project.wiki, **opts) }
let(:wiki_page_sample_data) { Gitlab::DataBuilder::WikiPage.build(wiki_page, user, 'create') }