diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-26 13:35:29 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-01 14:32:21 +0100 |
commit | 8d23b9647e0498d7b654e238fc93af7016218bcb (patch) | |
tree | 20cc20d3c803a81b1d4e36d3ce4197b173bf9e28 | |
parent | 79a37423a34bb7e07e6b194feb0a515b7e7e965d (diff) | |
download | gitlab-ce-8d23b9647e0498d7b654e238fc93af7016218bcb.tar.gz |
Simplify view specs for commit status badge partialfix/ci-status-badge-view-specs
-rw-r--r-- | spec/views/ci/status/_badge.html.haml_spec.rb | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/spec/views/ci/status/_badge.html.haml_spec.rb b/spec/views/ci/status/_badge.html.haml_spec.rb index 04ee841da00..c62450fb8e2 100644 --- a/spec/views/ci/status/_badge.html.haml_spec.rb +++ b/spec/views/ci/status/_badge.html.haml_spec.rb @@ -10,13 +10,13 @@ describe 'ci/status/_badge', :view do create(:ci_build, :success, pipeline: pipeline) end - context 'when status has details' do + context 'when user has ability to see details' do before do project.add_developer(user) end it 'has link to build details page' do - details_path = namespace_project_build_path( + details_path = namespace_project_build_path( project.namespace, project, build) render_status(build) @@ -25,7 +25,7 @@ describe 'ci/status/_badge', :view do end end - context 'when status does not have details' do + context 'when user do not have ability to see build details' do before do render_status(build) end @@ -41,39 +41,44 @@ describe 'ci/status/_badge', :view do end context 'when rendering status for external job' do - before do - project.add_developer(use) + context 'when user has ability to see commit status details' do + before do + project.add_developer(user) + end - render_status(external_job) - end + context 'status has external target url' do + before do + external_job = create(:generic_commit_status, + status: :running, + pipeline: pipeline, + target_url: 'http://gitlab.com') - context 'status has external target url' do - let(:external_job) do - create(:generic_commit_status, status: :running, - pipeline: pipeline, - target_url: 'http://gitlab.com') - end + render_status(external_job) + end - it 'contains valid commit status text' do - expect(rendered).to have_content 'running' - end + it 'contains valid commit status text' do + expect(rendered).to have_content 'running' + end - it 'has link to external status page' do - expect(rendered).to have_link 'running', href: 'http://gitlab.com' + it 'has link to external status page' do + expect(rendered).to have_link 'running', href: 'http://gitlab.com' + end end - end - context 'status do not have external target url' do - let(:external_job) do - create(:generic_commit_status, status: :canceled) - end + context 'status do not have external target url' do + before do + external_job = create(:generic_commit_status, status: :canceled) - it 'contains valid commit status text' do - expect(rendered).to have_content 'canceled' - end + render_status(external_job) + end + + it 'contains valid commit status text' do + expect(rendered).to have_content 'canceled' + end - it 'has link to external status page' do - expect(rendered).not_to have_link 'canceled' + it 'has link to external status page' do + expect(rendered).not_to have_link 'canceled' + end end end end |