BigW Consortium Gitlab

runner_entity_spec.rb 640 Bytes
Newer Older
1 2 3
require 'spec_helper'

describe RunnerEntity do
Z.J. van de Weg committed
4
  let(:runner) { create(:ci_runner, :specific) }
5 6
  let(:entity) { described_class.new(runner, request: request, current_user: user) }
  let(:request) { double('request') }
7
  let(:project) { create(:project) }
8 9 10 11 12 13
  let(:user) { create(:admin) }

  before do
    allow(request).to receive(:current_user).and_return(user)
    allow(request).to receive(:project).and_return(project)
  end
14 15 16 17 18

  describe '#as_json' do
    subject { entity.as_json }

    it 'contains required fields' do
19
      expect(subject).to include(:id, :description)
Z.J. van de Weg committed
20
      expect(subject).to include(:edit_path)
21 22 23
    end
  end
end