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