summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-11 15:34:29 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-11 15:34:29 +0100
commita30377c6f1415a863bd40d1876e3cf4c46bb9f5d (patch)
tree338a7ae15e34d4ae65adb2717f53998e12b58f34 /spec/requests/api
parent4e70f2519bba83d5f9d6fd0bed80e9837e8b5fc5 (diff)
parent1ede18bfa84a47ade94a0fe1acd246233db02693 (diff)
downloadgitlab-ce-a30377c6f1415a863bd40d1876e3cf4c46bb9f5d.tar.gz
Merge branch 'master' into ci/api-builds
* master: (143 commits) Only load autocomplete data when actually needed Check for current user Add pencil icon to edit group settings Issue #5817 wording of the web hooks updated on issue and merge events use JavaScript instead of CoffeeScript in Views, the reason #9819 Before project save ensure that a runners_token exists Fix Error 500 when visiting build page of project with nil runners_token Remove outdated gitlab-git-http-server reference from Install doc Fix typo in build page of projects Update docs for shared runner default settings Disable "Already Blocked" button in admin abuse report page Add CHANGELOG entry for reply-by-email fix Use WOFF versions of SourceSansPro Clean up document on adding users to a project Refactor ZenMode Fix caching issue where build status was not updating in project dashboard Add a CHANGELOG entry for The Most Important Feature of All Time(TM) changes verb `references` to noun `reference`. fixes new branch button positioning, when visible and not visible container DRY up upload and download services ...
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/projects_spec.rb14
-rw-r--r--spec/requests/api/tags_spec.rb21
2 files changed, 35 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index ab2530859ea..6f4c336b66c 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -353,6 +353,20 @@ describe API::API, api: true do
end
end
+ describe "POST /projects/:id/uploads" do
+ before { project }
+
+ it "uploads the file and returns its info" do
+ post api("/projects/#{project.id}/uploads", user), file: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")
+
+ expect(response.status).to be(201)
+ expect(json_response['alt']).to eq("dk")
+ expect(json_response['url']).to start_with("/uploads/")
+ expect(json_response['url']).to end_with("/dk.png")
+ expect(json_response['is_image']).to eq(true)
+ end
+ end
+
describe 'GET /projects/:id' do
before { project }
before { project_member }
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index 17f2643fd45..f966e38cd3e 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -65,6 +65,27 @@ describe API::API, api: true do
end
end
+ describe 'DELETE /projects/:id/repository/tags/:tag_name' do
+ let(:tag_name) { project.repository.tag_names.sort.reverse.first }
+
+ before do
+ allow_any_instance_of(Repository).to receive(:rm_tag).and_return(true)
+ end
+
+ context 'delete tag' do
+ it 'should delete an existing tag' do
+ delete api("/projects/#{project.id}/repository/tags/#{tag_name}", user)
+ expect(response.status).to eq(200)
+ expect(json_response['tag_name']).to eq(tag_name)
+ end
+
+ it 'should raise 404 if the tag does not exist' do
+ delete api("/projects/#{project.id}/repository/tags/foobar", user)
+ expect(response.status).to eq(404)
+ end
+ end
+ end
+
context 'annotated tag' do
it 'should create a new annotated tag' do
# Identity must be set in .gitconfig to create annotated tag.