summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-06 12:58:13 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-06 17:15:15 +0200
commit3dbef510c187606ef12eb9f2aaf51f30ddc3e30d (patch)
tree4c28e2c7fa41f8a677a3d9f138edef9f93093422 /spec/serializers
parent5525db8b33bf1f76c4a8023ea4fb571d73e41b0f (diff)
downloadgitlab-ce-3dbef510c187606ef12eb9f2aaf51f30ddc3e30d.tar.gz
Expose manual action abilities from a build entity
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/build_entity_spec.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/serializers/build_entity_spec.rb b/spec/serializers/build_entity_spec.rb
index f76a5cf72d1..897a28b7305 100644
--- a/spec/serializers/build_entity_spec.rb
+++ b/spec/serializers/build_entity_spec.rb
@@ -41,13 +41,37 @@ describe BuildEntity do
it 'does not contain path to play action' do
expect(subject).not_to include(:play_path)
end
+
+ it 'is not a playable job' do
+ expect(subject[:playable]).to be false
+ end
end
context 'when build is a manual action' do
let(:build) { create(:ci_build, :manual) }
- it 'contains path to play action' do
- expect(subject).to include(:play_path)
+ context 'when user is allowed to trigger action' do
+ before do
+ build.project.add_master(user)
+ end
+
+ it 'contains path to play action' do
+ expect(subject).to include(:play_path)
+ end
+
+ it 'is a playable action' do
+ expect(subject[:playable]).to be true
+ end
+ end
+
+ context 'when user is not allowed to trigger action' do
+ it 'does not contain path to play action' do
+ expect(subject).not_to include(:play_path)
+ end
+
+ it 'is not a playable action' do
+ expect(subject[:playable]).to be false
+ end
end
end
end