Skip to content
Snippets Groups Projects
Commit 4f2cc595 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Extend action tooltop to show info about abilities

parent 6baaa8a9
No related branches found
No related tags found
2 merge requests!11056WIP: Resolve "Display performance deltas between app deployments on Merge Request workflow",!10494Check access to a branch when user triggers manual action
Pipeline #
Loading
@@ -6,7 +6,11 @@ module Gitlab
Loading
@@ -6,7 +6,11 @@ module Gitlab
include Status::Extended include Status::Extended
   
def label def label
if has_action?
'manual play action' 'manual play action'
else
'manual play action (not allowed)'
end
end end
   
def has_action? def has_action?
Loading
Loading
Loading
@@ -216,7 +216,7 @@ describe Gitlab::Ci::Status::Build::Factory do
Loading
@@ -216,7 +216,7 @@ describe Gitlab::Ci::Status::Build::Factory do
expect(status.group).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.favicon).to eq 'favicon_status_manual' expect(status.favicon).to eq 'favicon_status_manual'
expect(status.label).to eq 'manual play action' expect(status.label).to include 'manual play action'
expect(status).to have_details expect(status).to have_details
expect(status.action_path).to include 'play' expect(status.action_path).to include 'play'
end end
Loading
Loading
require 'spec_helper' require 'spec_helper'
   
describe Gitlab::Ci::Status::Build::Play do describe Gitlab::Ci::Status::Build::Play do
let(:status) { double('core') }
let(:user) { double('user') }
subject { described_class.new(status) }
describe '#label' do
it { expect(subject.label).to eq 'manual play action' }
end
describe 'action details' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:build) { create(:ci_build, :manual) } let(:build) { create(:ci_build, :manual) }
let(:status) { Gitlab::Ci::Status::Core.new(build, user) } let(:status) { Gitlab::Ci::Status::Core.new(build, user) }
   
describe '#has_action?' do subject { described_class.new(status) }
context 'when user is allowed to update build' do context 'when user is allowed to update build' do
context 'when user can push to branch' do context 'when user can push to branch' do
before { build.project.add_master(user) } before { build.project.add_master(user) }
   
describe '#has_action?' do
it { is_expected.to have_action } it { is_expected.to have_action }
end end
   
describe '#label' do
it 'has a label that says it is a manual action' do
expect(subject.label).to eq 'manual play action'
end
end
end
context 'when user can not push to the branch' do context 'when user can not push to the branch' do
before { build.project.add_developer(user) } before { build.project.add_developer(user) }
   
describe 'has_action?' do
it { is_expected.not_to have_action } it { is_expected.not_to have_action }
end end
describe '#label' do
it 'has a label that says user is not allowed to play it' do
expect(subject.label).to eq 'manual play action (not allowed)'
end
end
end
end end
   
context 'when user is not allowed to update build' do context 'when user is not allowed to update build' do
describe '#has_action?' do
it { is_expected.not_to have_action } it { is_expected.not_to have_action }
end end
end end
Loading
@@ -46,7 +54,6 @@ describe Gitlab::Ci::Status::Build::Play do
Loading
@@ -46,7 +54,6 @@ describe Gitlab::Ci::Status::Build::Play do
describe '#action_title' do describe '#action_title' do
it { expect(subject.action_title).to eq 'Play' } it { expect(subject.action_title).to eq 'Play' }
end end
end
   
describe '.matches?' do describe '.matches?' do
subject { described_class.matches?(build, user) } subject { described_class.matches?(build, user) }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment