summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-17 17:25:17 +0100
committerToon Claes <toon@gitlab.com>2017-03-20 14:39:37 +0100
commit16cca3a0ea7f4b95e99d7b3e8d4953334fa7bec7 (patch)
treed45d895d35ab796b2d5f705bdd3554098c949395 /spec/serializers
parent7a623907528a77187e070c9721469df8bdd00ec8 (diff)
downloadgitlab-ce-16cca3a0ea7f4b95e99d7b3e8d4953334fa7bec7.tar.gz
Expose if action is playable in JSON
To avoid a manual build action being played (resulting in a 404), expose `playable?` in the JSON so the frontend can disable/hide the play button if it's not playable.
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/build_action_entity_spec.rb4
-rw-r--r--spec/serializers/build_entity_spec.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/spec/serializers/build_action_entity_spec.rb b/spec/serializers/build_action_entity_spec.rb
index 0f7be8b2c39..54ac17447b1 100644
--- a/spec/serializers/build_action_entity_spec.rb
+++ b/spec/serializers/build_action_entity_spec.rb
@@ -17,5 +17,9 @@ describe BuildActionEntity do
it 'contains path to the action play' do
expect(subject[:path]).to include "builds/#{build.id}/play"
end
+
+ it 'contains whether it is playable' do
+ expect(subject[:playable]).to eq build.playable?
+ end
end
end
diff --git a/spec/serializers/build_entity_spec.rb b/spec/serializers/build_entity_spec.rb
index 60c9642ee2c..eed957fa5ef 100644
--- a/spec/serializers/build_entity_spec.rb
+++ b/spec/serializers/build_entity_spec.rb
@@ -18,6 +18,10 @@ describe BuildEntity do
expect(subject).not_to include(/variables/)
end
+ it 'contains whether it is playable' do
+ expect(subject[:playable]).to eq build.playable?
+ end
+
it 'contains timestamps' do
expect(subject).to include(:created_at, :updated_at)
end