diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-08 12:38:36 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-08 12:38:36 +0200 |
commit | bc17996227117bcaf11dc41a0dd2b2f11a7329f4 (patch) | |
tree | 0afb39f69d0f5a9f6c022466d470e4c09a8e56b5 /spec/lib/gitlab/badge | |
parent | 8ae222092dc63d672dc505358d7bdfbb8478c774 (diff) | |
download | gitlab-ce-bc17996227117bcaf11dc41a0dd2b2f11a7329f4.tar.gz |
Improve builds badge specs, remove legacy methods
Diffstat (limited to 'spec/lib/gitlab/badge')
-rw-r--r-- | spec/lib/gitlab/badge/build_spec.rb | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/spec/lib/gitlab/badge/build_spec.rb b/spec/lib/gitlab/badge/build_spec.rb index 1b36c0a36ea..f9abbdaf585 100644 --- a/spec/lib/gitlab/badge/build_spec.rb +++ b/spec/lib/gitlab/badge/build_spec.rb @@ -6,11 +6,6 @@ describe Gitlab::Badge::Build do let(:branch) { 'master' } let(:badge) { described_class.new(project, branch) } - describe '#type' do - subject { badge.type } - it { is_expected.to eq 'image/svg+xml' } - end - describe '#metadata' do it 'returns badge metadata' do expect(badge.metadata.image_url) @@ -18,6 +13,12 @@ describe Gitlab::Badge::Build do end end + describe '#key_text' do + it 'always says build' do + expect(badge.key_text).to eq 'build' + end + end + context 'build exists' do let!(:build) { create_build(project, sha, branch) } @@ -30,11 +31,9 @@ describe Gitlab::Badge::Build do end end - describe '#data' do - let(:data) { badge.data } - - it 'contains information about success' do - expect(status_node(data, 'success')).to be_truthy + describe '#value_text' do + it 'returns correct value text' do + expect(badge.value_text).to eq 'success' end end end @@ -48,11 +47,9 @@ describe Gitlab::Badge::Build do end end - describe '#data' do - let(:data) { badge.data } - - it 'contains information about failure' do - expect(status_node(data, 'failed')).to be_truthy + describe '#value_text' do + it 'has correct value text' do + expect(badge.value_text).to eq 'failed' end end end @@ -65,11 +62,9 @@ describe Gitlab::Badge::Build do end end - describe '#data' do - let(:data) { badge.data } - - it 'contains infromation about unknown build' do - expect(status_node(data, 'unknown')).to be_truthy + describe '#value_text' do + it 'has correct value text' do + expect(badge.value_text).to eq 'unknown' end end end @@ -95,9 +90,4 @@ describe Gitlab::Badge::Build do create(:ci_build, pipeline: pipeline, stage: 'notify') end - - def status_node(data, status) - xml = Nokogiri::XML.parse(data) - xml.at(%Q{text:contains("#{status}")}) - end end |