summaryrefslogtreecommitdiff
path: root/spec/lib/api/entities/branch_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/api/entities/branch_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/api/entities/branch_spec.rb')
-rw-r--r--spec/lib/api/entities/branch_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/api/entities/branch_spec.rb b/spec/lib/api/entities/branch_spec.rb
new file mode 100644
index 00000000000..604f56c0cb2
--- /dev/null
+++ b/spec/lib/api/entities/branch_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Entities::Branch do
+ 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