diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-18 14:11:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-18 14:11:44 +0300 |
commit | 25989ab7ef1a444ed2abd5479f176d58e1d9462a (patch) | |
tree | 271bb24f3c7178f320cb9de0be0833a285327d09 /spec/lib/gitlab/ci | |
parent | 9bbb32b29703f3ce33dd35d5101145774b793a6d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci')
4 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata/entry_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata/entry_spec.rb index 24d17eb0fb3..73c3cad88bc 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata/entry_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata/entry_spec.rb @@ -34,27 +34,32 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe '#basename' do subject { |example| path(example).basename } + it { is_expected.to eq 'absolute_path' } end end describe 'path/dir_1/', path: 'path/dir_1/' do subject { |example| path(example) } + it { is_expected.to have_parent } it { is_expected.to be_directory } describe '#basename' do subject { |example| path(example).basename } + it { is_expected.to eq 'dir_1/' } end describe '#name' do subject { |example| path(example).name } + it { is_expected.to eq 'dir_1' } end describe '#parent' do subject { |example| path(example).parent } + it { is_expected.to eq entry('path/') } end @@ -102,21 +107,25 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe '#nodes' do subject { |example| path(example).nodes } + it { is_expected.to eq 2 } end describe '#exists?' do subject { |example| path(example).exists? } + it { is_expected.to be true } end describe '#empty?' do subject { |example| path(example).empty? } + it { is_expected.to be false } end describe '#total_size' do subject { |example| path(example).total_size } + it { is_expected.to eq(30) } end end @@ -124,10 +133,12 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe 'empty path', path: '' do subject { |example| path(example) } + it { is_expected.not_to have_parent } describe '#children' do subject { |example| path(example).children } + it { expect(subject.count).to eq 3 } end end @@ -135,6 +146,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe 'path/dir_1/subdir/subfile', path: 'path/dir_1/subdir/subfile' do describe '#nodes' do subject { |example| path(example).nodes } + it { is_expected.to eq 4 } end @@ -153,11 +165,13 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe 'non-existent/', path: 'non-existent/' do describe '#empty?' do subject { |example| path(example).empty? } + it { is_expected.to be true } end describe '#exists?' do subject { |example| path(example).exists? } + it { is_expected.to be false } end end @@ -165,6 +179,7 @@ describe Gitlab::Ci::Build::Artifacts::Metadata::Entry do describe 'another_directory/', path: 'another_directory/' do describe '#empty?' do subject { |example| path(example).empty? } + it { is_expected.to be true } end end diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb index ff189c4701e..bfa65c66b33 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb @@ -76,21 +76,25 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do describe '#to_entry' do subject { metadata('').to_entry } + it { is_expected.to be_an_instance_of(Gitlab::Ci::Build::Artifacts::Metadata::Entry) } end describe '#full_version' do subject { metadata('').full_version } + it { is_expected.to eq 'GitLab Build Artifacts Metadata 0.0.1' } end describe '#version' do subject { metadata('').version } + it { is_expected.to eq '0.0.1' } end describe '#errors' do subject { metadata('').errors } + it { is_expected.to eq({}) } end end diff --git a/spec/lib/gitlab/ci/config/entry/cache_spec.rb b/spec/lib/gitlab/ci/config/entry/cache_spec.rb index 4cb63168ec7..9aab3664e1c 100644 --- a/spec/lib/gitlab/ci/config/entry/cache_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/cache_spec.rb @@ -69,6 +69,7 @@ describe Gitlab::Ci::Config::Entry::Cache do context 'when entry value is not correct' do describe '#errors' do subject { entry.errors } + context 'when is not a hash' do let(:config) { 'ls' } diff --git a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb index 48d0864cfca..877e3ec6216 100644 --- a/spec/lib/gitlab/ci/config/entry/coverage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/coverage_spec.rb @@ -11,11 +11,13 @@ describe Gitlab::Ci::Config::Entry::Coverage do describe '#errors' do subject { entry.errors } + it { is_expected.to include(/coverage config must be a regular expression/) } end describe '#valid?' do subject { entry } + it { is_expected.not_to be_valid } end end @@ -25,16 +27,19 @@ describe Gitlab::Ci::Config::Entry::Coverage do describe '#value' do subject { entry.value } + it { is_expected.to eq(config[1...-1]) } end describe '#errors' do subject { entry.errors } + it { is_expected.to be_empty } end describe '#valid?' do subject { entry } + it { is_expected.to be_valid } end end @@ -44,11 +49,13 @@ describe Gitlab::Ci::Config::Entry::Coverage do describe '#errors' do subject { entry.errors } + it { is_expected.to include(/coverage config must be a regular expression/) } end describe '#valid?' do subject { entry } + it { is_expected.not_to be_valid } end end |