debian-mirror-gitlab/spec/views/projects/builds/show.html.haml_spec.rb

69 lines
1.8 KiB
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
require 'spec_helper'
describe 'projects/builds/show' do
2016-11-03 12:29:30 +05:30
include Devise::Test::ControllerHelpers
2016-08-24 12:49:21 +05:30
let(:project) { create(:project) }
let(:pipeline) do
create(:ci_pipeline, project: project,
sha: project.commit.id)
end
let(:build) { create(:ci_build, pipeline: pipeline) }
before do
assign(:build, build)
assign(:project, project)
allow(view).to receive(:can?).and_return(true)
end
context 'when build is running' do
before do
build.run!
render
end
it 'does not show retry button' do
expect(rendered).not_to have_link('Retry')
end
end
context 'when build is not running' do
before do
build.success!
render
end
it 'shows retry button' do
expect(rendered).to have_link('Retry')
end
end
describe 'commit title in sidebar' do
let(:commit_title) { project.commit.title }
it 'shows commit title and not show commit message' do
render
2016-09-13 17:45:13 +05:30
2016-08-24 12:49:21 +05:30
expect(rendered).to have_css('p.build-light-text.append-bottom-0',
text: /\A\n#{Regexp.escape(commit_title)}\n\Z/)
end
end
2016-09-13 17:45:13 +05:30
describe 'shows trigger variables in sidebar' do
let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline) }
before do
build.trigger_request = trigger_request
render
end
it 'shows trigger variables in separate lines' do
2016-09-29 09:46:39 +05:30
expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_1')
expect(rendered).to have_css('.js-build-variable', visible: false, text: 'TRIGGER_KEY_2')
expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_1')
expect(rendered).to have_css('.js-build-value', visible: false, text: 'TRIGGER_VALUE_2')
2016-09-13 17:45:13 +05:30
end
end
2016-08-24 12:49:21 +05:30
end