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-02-13 18:08:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-13 18:08:52 +0300
commit0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch)
tree5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /spec/support
parent1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/fake_blob_helpers.rb4
-rw-r--r--spec/support/helpers/metrics_dashboard_helpers.rb4
-rw-r--r--spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb16
-rw-r--r--spec/support/shared_examples/services/boards/boards_list_service_shared_examples.rb15
5 files changed, 32 insertions, 11 deletions
diff --git a/spec/support/helpers/fake_blob_helpers.rb b/spec/support/helpers/fake_blob_helpers.rb
index ef4740638ff..a7eafb0fd23 100644
--- a/spec/support/helpers/fake_blob_helpers.rb
+++ b/spec/support/helpers/fake_blob_helpers.rb
@@ -37,6 +37,8 @@ module FakeBlobHelpers
end
def fake_blob(**kwargs)
- Blob.decorate(FakeBlob.new(**kwargs), project)
+ container = kwargs.delete(:container) || project
+
+ Blob.decorate(FakeBlob.new(**kwargs), container)
end
end
diff --git a/spec/support/helpers/metrics_dashboard_helpers.rb b/spec/support/helpers/metrics_dashboard_helpers.rb
index 908a3e1fb09..b8a641d5911 100644
--- a/spec/support/helpers/metrics_dashboard_helpers.rb
+++ b/spec/support/helpers/metrics_dashboard_helpers.rb
@@ -29,4 +29,8 @@ module MetricsDashboardHelpers
def business_metric_title
PrometheusMetricEnums.group_details[:business][:group_title]
end
+
+ def self_monitoring_dashboard_path
+ Metrics::Dashboard::SelfMonitoringDashboardService::DASHBOARD_PATH
+ end
end
diff --git a/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb
index 3d88b317417..69ae9339f10 100644
--- a/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/repo_type_shared_examples.rb
@@ -2,7 +2,7 @@
RSpec.shared_examples 'a repo type' do
describe '#identifier_for_container' do
- subject { described_class.identifier_for_container(project) }
+ subject { described_class.identifier_for_container(expected_container) }
it { is_expected.to eq(expected_identifier) }
end
@@ -35,7 +35,7 @@ RSpec.shared_examples 'a repo type' do
describe '#repository_for' do
it 'finds the repository for the repo type' do
- expect(described_class.repository_for(project)).to eq(expected_repository)
+ expect(described_class.repository_for(expected_container)).to eq(expected_repository)
end
end
end
diff --git a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
index fdea312dfa9..d5606e65981 100644
--- a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
@@ -18,7 +18,7 @@ RSpec.shared_examples 'model with repository' do
let(:only_path) { false }
it 'returns the full web URL for this repo' do
- expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{expected_full_path}")
+ expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{expected_web_url_path}")
end
end
@@ -26,7 +26,7 @@ RSpec.shared_examples 'model with repository' do
let(:only_path) { true }
it 'returns the relative web URL for this repo' do
- expect(subject).to eq("/#{expected_full_path}")
+ expect(subject).to eq("/#{expected_web_url_path}")
end
end
@@ -34,14 +34,14 @@ RSpec.shared_examples 'model with repository' do
let(:only_path) { nil }
it 'returns the full web URL for this repo' do
- expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{expected_full_path}")
+ expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{expected_web_url_path}")
end
end
end
context 'when not given the only_path option' do
it 'returns the full web URL for this repo' do
- expect(container.web_url).to eq("#{Gitlab.config.gitlab.url}/#{expected_full_path}")
+ expect(container.web_url).to eq("#{Gitlab.config.gitlab.url}/#{expected_web_url_path}")
end
end
end
@@ -72,7 +72,7 @@ RSpec.shared_examples 'model with repository' do
let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab/' }
it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}#{expected_full_path}.git")
+ expect(subject).to eq("#{custom_http_clone_url_root}#{expected_web_url_path}.git")
end
end
@@ -80,7 +80,7 @@ RSpec.shared_examples 'model with repository' do
let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab' }
it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_full_path}.git")
+ expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_web_url_path}.git")
end
end
end
@@ -90,7 +90,7 @@ RSpec.shared_examples 'model with repository' do
let(:custom_http_clone_url_root) { 'https://git.example.com:51234/' }
it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}#{expected_full_path}.git")
+ expect(subject).to eq("#{custom_http_clone_url_root}#{expected_web_url_path}.git")
end
end
@@ -98,7 +98,7 @@ RSpec.shared_examples 'model with repository' do
let(:custom_http_clone_url_root) { 'https://git.example.com:51234' }
it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_full_path}.git")
+ expect(subject).to eq("#{custom_http_clone_url_root}/#{expected_web_url_path}.git")
end
end
end
diff --git a/spec/support/shared_examples/services/boards/boards_list_service_shared_examples.rb b/spec/support/shared_examples/services/boards/boards_list_service_shared_examples.rb
index 1488027201c..8f7c08ed625 100644
--- a/spec/support/shared_examples/services/boards/boards_list_service_shared_examples.rb
+++ b/spec/support/shared_examples/services/boards/boards_list_service_shared_examples.rb
@@ -50,5 +50,20 @@ RSpec.shared_examples 'multiple boards list service' do
it 'returns boards ordered by name' do
expect(service.execute).to eq [board_a, board_B, board_c]
end
+
+ context 'when wanting a specific board' do
+ it 'returns board specified by id' do
+ service = described_class.new(parent, double, board_id: board_c.id)
+
+ expect(service.execute).to eq [board_c]
+ end
+
+ it 'raises exception when board is not found' do
+ outside_board = create(:board, resource_parent: create(:project), name: 'outside board')
+ service = described_class.new(parent, double, board_id: outside_board.id)
+
+ expect { service.execute }.to raise_exception(ActiveRecord::RecordNotFound)
+ end
+ end
end
end