Commit 65c3bfe6 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend specs for build play/stop detailed statuses

parent 48d43608
...@@ -18,6 +18,36 @@ describe Gitlab::Ci::Status::Build::Play do ...@@ -18,6 +18,36 @@ describe Gitlab::Ci::Status::Build::Play do
it { expect(subject.icon).to eq 'icon_status_manual' } it { expect(subject.icon).to eq 'icon_status_manual' }
end 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 describe '.matches?' do
subject { described_class.matches?(build, user) } subject { described_class.matches?(build, user) }
......
...@@ -20,16 +20,34 @@ describe Gitlab::Ci::Status::Build::Stop do ...@@ -20,16 +20,34 @@ describe Gitlab::Ci::Status::Build::Stop do
it { expect(subject.icon).to eq 'icon_status_manual' } it { expect(subject.icon).to eq 'icon_status_manual' }
end end
describe '#has_action?' do describe 'action details' do
end let(:user) { create(:user) }
let(:build) { create(:ci_build) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
describe '#action_icon' do describe '#has_action?' do
end context 'when user is allowed to update build' do
before { build.project.team << [user, :developer] }
describe '#action_path' do it { is_expected.to have_action }
end 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_title' do 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 end
describe '.matches?' do describe '.matches?' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment