2016-12-21 08:47:20 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-12-21 08:51:53 -05:00
|
|
|
describe BuildActionEntity do
|
2017-05-16 07:41:15 -04:00
|
|
|
let(:job) { create(:ci_build, name: 'test_job') }
|
2017-04-12 09:22:32 -04:00
|
|
|
let(:request) { double('request') }
|
2016-12-21 08:47:20 -05:00
|
|
|
|
|
|
|
let(:entity) do
|
2017-05-16 07:41:15 -04:00
|
|
|
described_class.new(job, request: spy('request'))
|
2016-12-21 08:47:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
2017-05-16 07:41:15 -04:00
|
|
|
it 'contains original job name' do
|
|
|
|
expect(subject[:name]).to eq 'test_job'
|
2016-12-21 08:47:20 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains path to the action play' do
|
2017-05-16 07:41:15 -04:00
|
|
|
expect(subject[:path]).to include "jobs/#{job.id}/play"
|
2016-12-21 08:47:20 -05:00
|
|
|
end
|
2017-03-17 12:25:17 -04:00
|
|
|
|
|
|
|
it 'contains whether it is playable' do
|
2017-05-16 07:41:15 -04:00
|
|
|
expect(subject[:playable]).to eq job.playable?
|
2017-03-17 12:25:17 -04:00
|
|
|
end
|
2016-12-21 08:47:20 -05:00
|
|
|
end
|
|
|
|
end
|