diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
commit | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch) | |
tree | 5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /spec/support/shared_examples | |
parent | 1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff) | |
download | gitlab-ce-0ab47b994caa80c5587f33dc818626b66cfdafe2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
3 files changed, 25 insertions, 10 deletions
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 |