debian-mirror-gitlab/spec/lib/api/entities/branch_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
797 B
Ruby
Raw Normal View History

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