diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 18:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 18:18:50 +0300 |
commit | 3bdc719293f08ed357ef452f3e2a11a9b29531e7 (patch) | |
tree | b5a03109fd3704194d5707759d5ec0e4650bf177 /spec/models | |
parent | 1ae73e5bfcb2dc4a49f40886f729fc4797ba2a65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/blob_spec.rb | 14 | ||||
-rw-r--r-- | spec/models/ci/runner_spec.rb | 41 |
2 files changed, 42 insertions, 13 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index bd4832bd978..6eba9ca63b0 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -215,6 +215,20 @@ RSpec.describe Blob do end end + describe '#symlink?' do + it 'is true for symlinks' do + symlink_blob = fake_blob(path: 'file', mode: '120000') + + expect(symlink_blob.symlink?).to eq true + end + + it 'is false for non-symlinks' do + non_symlink_blob = fake_blob(path: 'file', mode: '100755') + + expect(non_symlink_blob.symlink?).to eq false + end + end + describe '#extension' do it 'returns the extension' do blob = fake_blob(path: 'file.md') diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 14ffb714c6e..275c9ef8f56 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -265,22 +265,37 @@ RSpec.describe Ci::Runner do it_behaves_like '.belonging_to_parent_group_of_project' end - describe '.owned_or_instance_wide' do - it 'returns a globally shared, a project specific and a group specific runner' do - # group specific - group = create(:group) - project = create(:project, group: group) - group_runner = create(:ci_runner, :group, groups: [group]) + context 'with existing system wide, group and project runners' do + # group specific + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } + let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group]) } - # project specific - project_runner = create(:ci_runner, :project, projects: [project]) + # project specific + let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project]) } - # globally shared - shared_runner = create(:ci_runner, :instance) + # globally shared + let_it_be(:shared_runner) { create(:ci_runner, :instance) } - expect(described_class.owned_or_instance_wide(project.id)).to contain_exactly( - group_runner, project_runner, shared_runner - ) + describe '.owned_or_instance_wide' do + subject { described_class.owned_or_instance_wide(project.id) } + + it 'returns a globally shared, a project specific and a group specific runner' do + is_expected.to contain_exactly(group_runner, project_runner, shared_runner) + end + end + + describe '.group_or_instance_wide' do + subject { described_class.group_or_instance_wide(group) } + + before do + # Ensure the project runner is instantiated + project_runner + end + + it 'returns a globally shared and a group specific runner' do + is_expected.to contain_exactly(group_runner, shared_runner) + end end end |