diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-06 19:38:17 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-17 09:05:24 +0100 |
commit | ce54a801feb62c768042587685b5848e06f0a6da (patch) | |
tree | 34e686eeabd11ade916fadf5c9c833394567834e /spec/requests/api/v3/branches_spec.rb | |
parent | c70dfbc68614658c98a0f17a01413844a2a98abf (diff) | |
download | gitlab-ce-ce54a801feb62c768042587685b5848e06f0a6da.tar.gz |
Backport API to v3paginate-all-the-things
Diffstat (limited to 'spec/requests/api/v3/branches_spec.rb')
-rw-r--r-- | spec/requests/api/v3/branches_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/requests/api/v3/branches_spec.rb b/spec/requests/api/v3/branches_spec.rb new file mode 100644 index 00000000000..0e4c6bc3bc6 --- /dev/null +++ b/spec/requests/api/v3/branches_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' +require 'mime/types' + +describe API::V3::Branches, api: true do + include ApiHelpers + + let(:user) { create(:user) } + let!(:project) { create(:project, :repository, creator: user) } + let!(:master) { create(:project_member, :master, user: user, project: project) } + + describe "GET /projects/:id/repository/branches" do + it "returns an array of project branches" do + project.repository.expire_all_method_caches + + get v3_api("/projects/#{project.id}/repository/branches", user), per_page: 100 + + expect(response).to have_http_status(200) + expect(json_response).to be_an Array + branch_names = json_response.map { |x| x['name'] } + expect(branch_names).to match_array(project.repository.branch_names) + end + end +end |