Commit ab37be2d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs for build stop extended detailed status

parent f91e8269
......@@ -13,10 +13,6 @@ module Gitlab
'stop'
end
def icon
'icon_status_skipped'
end
def has_action?
can?(user, :update_build, subject)
end
......
require 'spec_helper'
describe Gitlab::Ci::Status::Build::Stop do
let(:core_status) { double('core status') }
let(:user) { double('user') }
subject do
described_class.new(core_status)
end
describe '#text' do
it { expect(subject.text).to eq 'stop' }
end
describe '#label' do
it { expect(subject.label).to eq 'stop' }
end
describe '#icon' do
it 'does not override core status icon' do
expect(core_status).to receive(:icon)
subject.icon
end
end
describe '.matches?' do
context 'build is playable' do
context 'when build stops an environment' do
let(:build) do
create(:ci_build, :playable, :teardown_environment)
end
it 'is a correct match' do
expect(described_class.matches?(build, user))
.to be true
end
end
context 'when build does not stop an environment' do
let(:build) { create(:ci_build, :playable) }
it 'does not match' do
expect(described_class.matches?(build, user))
.to be false
end
end
end
context 'when build is not playable' do
let(:build) { create(:ci_build) }
it 'does not match' do
expect(described_class.matches?(build, user))
.to be false
end
end
end
end
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