debian-mirror-gitlab/spec/serializers/build_action_entity_spec.rb

27 lines
605 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe BuildActionEntity do
2017-09-10 17:25:29 +05:30
let(:job) { create(:ci_build, name: 'test_job') }
2017-08-17 22:00:37 +05:30
let(:request) { double('request') }
let(:entity) do
2017-09-10 17:25:29 +05:30
described_class.new(job, request: spy('request'))
2017-08-17 22:00:37 +05:30
end
describe '#as_json' do
subject { entity.as_json }
2017-09-10 17:25:29 +05:30
it 'contains original job name' do
expect(subject[:name]).to eq 'test_job'
2017-08-17 22:00:37 +05:30
end
it 'contains path to the action play' do
2017-09-10 17:25:29 +05:30
expect(subject[:path]).to include "jobs/#{job.id}/play"
2017-08-17 22:00:37 +05:30
end
it 'contains whether it is playable' do
2017-09-10 17:25:29 +05:30
expect(subject[:playable]).to eq job.playable?
2017-08-17 22:00:37 +05:30
end
end
end