BigW Consortium Gitlab

build_action_entity_spec.rb 575 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe BuildActionEntity do
4 5 6 7 8 9 10 11 12
  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 }

13 14
    it 'contains original build name' do
      expect(subject[:name]).to eq 'test_build'
15 16 17 18 19
    end

    it 'contains path to the action play' do
      expect(subject[:path]).to include "builds/#{build.id}/play"
    end
20 21 22 23

    it 'contains whether it is playable' do
      expect(subject[:playable]).to eq build.playable?
    end
24 25
  end
end