2019-09-30 05:06:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-23 11:10:07 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe RunnerEntity do
|
2018-05-23 07:23:49 -04:00
|
|
|
let(:project) { create(:project) }
|
|
|
|
let(:runner) { create(:ci_runner, :project, projects: [project]) }
|
2017-05-26 04:31:42 -04:00
|
|
|
let(:entity) { described_class.new(runner, request: request, current_user: user) }
|
|
|
|
let(:request) { double('request') }
|
2022-01-27 01:11:50 -05:00
|
|
|
let(:user) { project.first_owner }
|
2017-05-26 04:31:42 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
allow(request).to receive(:current_user).and_return(user)
|
|
|
|
allow(request).to receive(:project).and_return(project)
|
|
|
|
end
|
2017-05-23 11:10:07 -04:00
|
|
|
|
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
it 'contains required fields' do
|
2017-05-26 04:31:42 -04:00
|
|
|
expect(subject).to include(:id, :description)
|
2017-05-29 03:58:20 -04:00
|
|
|
expect(subject).to include(:edit_path)
|
2021-04-15 20:09:09 -04:00
|
|
|
expect(subject).to include(:short_sha)
|
2017-05-23 11:10:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|