Commit bb2460c1 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve specs for detailed statuses with manual actions

parent cb4c9a03
...@@ -5,22 +5,10 @@ module Gitlab ...@@ -5,22 +5,10 @@ module Gitlab
class Play < SimpleDelegator class Play < SimpleDelegator
include Status::Extended include Status::Extended
def text
'manual'
end
def label def label
'manual play action' 'manual play action'
end end
def icon
'icon_status_manual'
end
def group
'manual'
end
def has_action? def has_action?
can?(user, :update_build, subject) can?(user, :update_build, subject)
end end
......
...@@ -5,22 +5,10 @@ module Gitlab ...@@ -5,22 +5,10 @@ module Gitlab
class Stop < SimpleDelegator class Stop < SimpleDelegator
include Status::Extended include Status::Extended
def text
'manual'
end
def label def label
'manual stop action' 'manual stop action'
end end
def icon
'icon_status_manual'
end
def group
'manual'
end
def has_action? def has_action?
can?(user, :update_build, subject) can?(user, :update_build, subject)
end end
......
...@@ -200,12 +200,13 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -200,12 +200,13 @@ describe Gitlab::Ci::Status::Build::Factory do
.to eq [Gitlab::Ci::Status::Build::Play] .to eq [Gitlab::Ci::Status::Build::Play]
end end
it 'fabricates a core skipped status' do it 'fabricates a play detailed status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Play expect(status).to be_a Gitlab::Ci::Status::Build::Play
end end
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'manual' expect(status.text).to eq 'manual'
expect(status.group).to eq 'manual'
expect(status.icon).to eq 'icon_status_manual' expect(status.icon).to eq 'icon_status_manual'
expect(status.label).to eq 'manual play action' expect(status.label).to eq 'manual play action'
expect(status).to have_details expect(status).to have_details
...@@ -226,12 +227,13 @@ describe Gitlab::Ci::Status::Build::Factory do ...@@ -226,12 +227,13 @@ describe Gitlab::Ci::Status::Build::Factory do
.to eq [Gitlab::Ci::Status::Build::Stop] .to eq [Gitlab::Ci::Status::Build::Stop]
end end
it 'fabricates a core skipped status' do it 'fabricates a stop detailed status' do
expect(status).to be_a Gitlab::Ci::Status::Build::Stop expect(status).to be_a Gitlab::Ci::Status::Build::Stop
end end
it 'fabricates status with correct details' do it 'fabricates status with correct details' do
expect(status.text).to eq 'manual' expect(status.text).to eq 'manual'
expect(status.group).to eq 'manual'
expect(status.icon).to eq 'icon_status_manual' expect(status.icon).to eq 'icon_status_manual'
expect(status.label).to eq 'manual stop action' expect(status.label).to eq 'manual stop action'
expect(status).to have_details expect(status).to have_details
......
...@@ -6,22 +6,10 @@ describe Gitlab::Ci::Status::Build::Play do ...@@ -6,22 +6,10 @@ describe Gitlab::Ci::Status::Build::Play do
subject { described_class.new(status) } subject { described_class.new(status) }
describe '#text' do
it { expect(subject.text).to eq 'manual' }
end
describe '#label' do describe '#label' do
it { expect(subject.label).to eq 'manual play action' } it { expect(subject.label).to eq 'manual play action' }
end end
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_manual' }
end
describe '#group' do
it { expect(subject.group).to eq 'manual' }
end
describe 'action details' do describe 'action details' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:build) { create(:ci_build) } let(:build) { create(:ci_build) }
......
...@@ -8,22 +8,10 @@ describe Gitlab::Ci::Status::Build::Stop do ...@@ -8,22 +8,10 @@ describe Gitlab::Ci::Status::Build::Stop do
described_class.new(status) described_class.new(status)
end end
describe '#text' do
it { expect(subject.text).to eq 'manual' }
end
describe '#label' do describe '#label' do
it { expect(subject.label).to eq 'manual stop action' } it { expect(subject.label).to eq 'manual stop action' }
end end
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_manual' }
end
describe '#group' do
it { expect(subject.group).to eq 'manual' }
end
describe 'action details' do describe 'action details' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:build) { create(:ci_build) } let(:build) { create(:ci_build) }
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Canceled do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Canceled do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'canceled' } it { expect(subject.text).to eq 'canceled' }
end end
describe '#label' do describe '#label' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Created do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Created do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'created' } it { expect(subject.text).to eq 'created' }
end end
describe '#label' do describe '#label' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Failed do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Failed do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'failed' } it { expect(subject.text).to eq 'failed' }
end end
describe '#label' do describe '#label' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Manual do
subject do
described_class.new(double('subject'), double('user'))
end
describe '#text' do
it { expect(subject.text).to eq 'manual' }
end
describe '#label' do
it { expect(subject.label).to eq 'manual action' }
end
describe '#icon' do
it { expect(subject.icon).to eq 'icon_status_manual' }
end
describe '#group' do
it { expect(subject.group).to eq 'manual' }
end
end
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Pending do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Pending do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'pending' } it { expect(subject.text).to eq 'pending' }
end end
describe '#label' do describe '#label' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Running do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Running do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'running' } it { expect(subject.text).to eq 'running' }
end end
describe '#label' do describe '#label' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Skipped do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Skipped do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'skipped' } it { expect(subject.text).to eq 'skipped' }
end end
describe '#label' do describe '#label' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Success do ...@@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Success do
end end
describe '#text' do describe '#text' do
it { expect(subject.label).to eq 'passed' } it { expect(subject.text).to eq 'passed' }
end end
describe '#label' do describe '#label' do
......
...@@ -643,6 +643,14 @@ describe Ci::Pipeline, models: true do ...@@ -643,6 +643,14 @@ describe Ci::Pipeline, models: true do
end end
end end
context 'when pipeline is blocked' do
let(:pipeline) { create(:ci_pipeline, status: :manual) }
it 'returns detailed status for blocked pipeline' do
expect(subject.text).to eq 'manual'
end
end
context 'when pipeline is successful but with warnings' do context 'when pipeline is successful but with warnings' do
let(:pipeline) { create(:ci_pipeline, status: :success) } let(:pipeline) { create(:ci_pipeline, status: :success) }
......
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