diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-24 12:08:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-24 12:08:01 +0000 |
commit | c6373a2cec855c6543a1e035c52099e102dd05ef (patch) | |
tree | 507c4d975e1bf559a008d997ad4b07dad14f397e /spec/lib | |
parent | 6593f1f627938f22090dec5221476772d3ed581d (diff) | |
download | gitlab-ce-c6373a2cec855c6543a1e035c52099e102dd05ef.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/banzai/filter/plantuml_filter_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/external/factory_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/factory_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/pipeline/factory_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/stage/factory_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/waiting_for_resource_spec.rb | 29 | ||||
-rw-r--r-- | spec/lib/gitlab/git/branch_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/git_spec.rb | 26 |
8 files changed, 35 insertions, 34 deletions
diff --git a/spec/lib/banzai/filter/plantuml_filter_spec.rb b/spec/lib/banzai/filter/plantuml_filter_spec.rb index 713bab4527b..abe525ac47a 100644 --- a/spec/lib/banzai/filter/plantuml_filter_spec.rb +++ b/spec/lib/banzai/filter/plantuml_filter_spec.rb @@ -26,7 +26,7 @@ describe Banzai::Filter::PlantumlFilter do it 'does not replace plantuml pre tag with img tag if url is invalid' do stub_application_setting(plantuml_enabled: true, plantuml_url: "invalid") input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>' - output = '<div class="listingblock"><div class="content"><pre class="plantuml plantuml-error"> PlantUML Error: cannot connect to PlantUML server at "invalid"</pre></div></div>' + output = '<div class="listingblock"><div class="content"><pre class="plantuml plantuml-error"> Error: cannot connect to PlantUML server at "invalid"</pre></div></div>' doc = filter(input) expect(doc.to_s).to eq output diff --git a/spec/lib/gitlab/ci/status/external/factory_spec.rb b/spec/lib/gitlab/ci/status/external/factory_spec.rb index 9d7dfc42848..9c11e42fc5a 100644 --- a/spec/lib/gitlab/ci/status/external/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/external/factory_spec.rb @@ -22,7 +22,7 @@ describe Gitlab::Ci::Status::External::Factory do end let(:expected_status) do - Gitlab::Ci::Status.const_get(simple_status.capitalize, false) + Gitlab::Ci::Status.const_get(simple_status.to_s.camelize, false) end it "fabricates a core status #{simple_status}" do diff --git a/spec/lib/gitlab/ci/status/factory_spec.rb b/spec/lib/gitlab/ci/status/factory_spec.rb index c6d7a1ec5d9..219eb53d9df 100644 --- a/spec/lib/gitlab/ci/status/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/factory_spec.rb @@ -13,7 +13,7 @@ describe Gitlab::Ci::Status::Factory do let(:resource) { double('resource', status: simple_status) } let(:expected_status) do - Gitlab::Ci::Status.const_get(simple_status.capitalize, false) + Gitlab::Ci::Status.const_get(simple_status.to_s.camelize, false) end it "fabricates a core status #{simple_status}" do diff --git a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb index 3acc767ab7a..838154759cb 100644 --- a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb @@ -18,7 +18,7 @@ describe Gitlab::Ci::Status::Pipeline::Factory do let(:pipeline) { create(:ci_pipeline, status: simple_status) } let(:expected_status) do - Gitlab::Ci::Status.const_get(simple_status.capitalize, false) + Gitlab::Ci::Status.const_get(simple_status.camelize, false) end it "matches correct core status for #{simple_status}" do diff --git a/spec/lib/gitlab/ci/status/stage/factory_spec.rb b/spec/lib/gitlab/ci/status/stage/factory_spec.rb index dcb53712157..317756ea13c 100644 --- a/spec/lib/gitlab/ci/status/stage/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/factory_spec.rb @@ -34,7 +34,7 @@ describe Gitlab::Ci::Status::Stage::Factory do it "fabricates a core status #{core_status}" do expect(status).to be_a( - Gitlab::Ci::Status.const_get(core_status.capitalize, false)) + Gitlab::Ci::Status.const_get(core_status.camelize, false)) end it 'extends core status with common stage methods' do diff --git a/spec/lib/gitlab/ci/status/waiting_for_resource_spec.rb b/spec/lib/gitlab/ci/status/waiting_for_resource_spec.rb new file mode 100644 index 00000000000..ed00dac8560 --- /dev/null +++ b/spec/lib/gitlab/ci/status/waiting_for_resource_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Ci::Status::WaitingForResource do + subject do + described_class.new(double('subject'), double('user')) + end + + describe '#text' do + it { expect(subject.text).to eq 'waiting' } + end + + describe '#label' do + it { expect(subject.label).to eq 'waiting for resource' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'status_pending' } + end + + describe '#favicon' do + it { expect(subject.favicon).to eq 'favicon_pending' } + end + + describe '#group' do + it { expect(subject.group).to eq 'waiting-for-resource' } + end +end diff --git a/spec/lib/gitlab/git/branch_spec.rb b/spec/lib/gitlab/git/branch_spec.rb index cc26b7e7fcd..cb3f4df2dbd 100644 --- a/spec/lib/gitlab/git/branch_spec.rb +++ b/spec/lib/gitlab/git/branch_spec.rb @@ -71,9 +71,7 @@ describe Gitlab::Git::Branch, :seed_helper do end let(:user) { create(:user) } - let(:committer) do - Gitlab::Git.committer_hash(email: user.email, name: user.name) - end + let(:committer) { { email: user.email, name: user.name } } let(:params) do parents = [rugged.head.target] tree = parents.first.tree diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb index cb07bbdbaaa..d6d12b84724 100644 --- a/spec/lib/gitlab/git_spec.rb +++ b/spec/lib/gitlab/git_spec.rb @@ -6,32 +6,6 @@ describe Gitlab::Git do let(:committer_email) { 'user@example.org' } let(:committer_name) { 'John Doe' } - describe 'committer_hash' do - it "returns a hash containing the given email and name" do - committer_hash = described_class.committer_hash(email: committer_email, name: committer_name) - - expect(committer_hash[:email]).to eq(committer_email) - expect(committer_hash[:name]).to eq(committer_name) - expect(committer_hash[:time]).to be_a(Time) - end - - context 'when email is nil' do - it "returns nil" do - committer_hash = described_class.committer_hash(email: nil, name: committer_name) - - expect(committer_hash).to be_nil - end - end - - context 'when name is nil' do - it "returns nil" do - committer_hash = described_class.committer_hash(email: committer_email, name: nil) - - expect(committer_hash).to be_nil - end - end - end - describe '.ref_name' do it 'ensure ref is a valid UTF-8 string' do utf8_invalid_ref = Gitlab::Git::BRANCH_REF_PREFIX + "an_invalid_ref_\xE5" |