2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RunnerEntity do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:runner) { create(:ci_runner, :project, projects: [project]) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:entity) { described_class.new(runner, request: request, current_user: user) }
|
|
|
|
let(:request) { double('request') }
|
|
|
|
let(:user) { create(:admin) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(request).to receive(:current_user).and_return(user)
|
|
|
|
allow(request).to receive(:project).and_return(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'contains required fields' do
|
|
|
|
expect(subject).to include(:id, :description)
|
|
|
|
expect(subject).to include(:edit_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|