Extend specs for build play/stop detailed statuses

This commit is contained in:
Grzegorz Bizon 2016-12-13 13:13:09 +01:00
parent 48d43608b8
commit 65c3bfe68a
2 changed files with 55 additions and 7 deletions

View file

@ -18,6 +18,36 @@ describe Gitlab::Ci::Status::Build::Play do
it { expect(subject.icon).to eq 'icon_status_manual' }
end
describe 'action details' do
let(:user) { create(:user) }
let(:build) { create(:ci_build) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
describe '#has_action?' do
context 'when user is allowed to update build' do
before { build.project.team << [user, :developer] }
it { is_expected.to have_action }
end
context 'when user is not allowed to update build' do
it { is_expected.not_to have_action }
end
end
describe '#action_path' do
it { expect(subject.action_path).to include "#{build.id}/play" }
end
describe '#action_icon' do
it { expect(subject.action_icon).to eq 'play' }
end
describe '#action_title' do
it { expect(subject.action_title).to eq 'Play' }
end
end
describe '.matches?' do
subject { described_class.matches?(build, user) }

View file

@ -20,16 +20,34 @@ describe Gitlab::Ci::Status::Build::Stop do
it { expect(subject.icon).to eq 'icon_status_manual' }
end
describe '#has_action?' do
end
describe 'action details' do
let(:user) { create(:user) }
let(:build) { create(:ci_build) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
describe '#action_icon' do
end
describe '#has_action?' do
context 'when user is allowed to update build' do
before { build.project.team << [user, :developer] }
describe '#action_path' do
end
it { is_expected.to have_action }
end
describe '#action_title' do
context 'when user is not allowed to update build' do
it { is_expected.not_to have_action }
end
end
describe '#action_path' do
it { expect(subject.action_path).to include "#{build.id}/play" }
end
describe '#action_icon' do
it { expect(subject.action_icon).to eq 'stop' }
end
describe '#action_title' do
it { expect(subject.action_title).to eq 'Stop' }
end
end
describe '.matches?' do