2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe API::Entities::Branch do
|
2020-05-24 23:13:21 +05:30
|
|
|
describe '#as_json' do
|
|
|
|
subject { entity.as_json }
|
|
|
|
|
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:repository) { project.repository }
|
|
|
|
let(:branch) { repository.find_branch('master') }
|
|
|
|
let(:entity) { described_class.new(branch, project: project) }
|
|
|
|
|
|
|
|
it 'includes basic fields', :aggregate_failures do
|
|
|
|
is_expected.to include(
|
|
|
|
name: 'master',
|
|
|
|
commit: a_kind_of(Hash),
|
|
|
|
merged: false,
|
|
|
|
protected: false,
|
|
|
|
developers_can_push: false,
|
|
|
|
developers_can_merge: false,
|
|
|
|
can_push: false,
|
|
|
|
default: true,
|
|
|
|
web_url: Gitlab::Routing.url_helpers.project_tree_url(project, 'master')
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|