Commit 446e920a1b0511eaf124b5c443d9f1c5a56b2667
1 parent
2490cfbc
Exists in
spb-stable
and in
2 other branches
Add tests for creating tag with API.
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
spec/requests/api/repositories_spec.rb
... | ... | @@ -23,6 +23,25 @@ describe API::API, api: true do |
23 | 23 | end |
24 | 24 | end |
25 | 25 | |
26 | + describe 'POST /projects/:id/repository/tags' do | |
27 | + it 'should create a new tag' do | |
28 | + post api("/projects/#{project.id}/repository/tags", user), | |
29 | + tag_name: 'v1.0.0', | |
30 | + ref: '621491c677087aa243f165eab467bfdfbee00be1' | |
31 | + | |
32 | + response.status.should == 201 | |
33 | + json_response.first['name'].should == 'v1.0.0' | |
34 | + json_response['commit']['id'].should == '621491c677087aa243f165eab467bfdfbee00be1' | |
35 | + end | |
36 | + it "should deny for user without push access" do | |
37 | + post api("/projects/#{project.id}/repository/tags", user2), | |
38 | + tag_name: 'v1.0.0', | |
39 | + ref: '621491c677087aa243f165eab467bfdfbee00be1' | |
40 | + | |
41 | + response.status.should == 403 | |
42 | + end | |
43 | + end | |
44 | + | |
26 | 45 | describe "GET /projects/:id/repository/tree" do |
27 | 46 | context "authorized user" do |
28 | 47 | before { project.team << [user2, :reporter] } | ... | ... |