Commit 1bae64d7f608e3d68d52fd59755216db6c70f7f4
1 parent
b6244581
Exists in
master
and in
4 other branches
whitespace
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
spec/requests/api/users_spec.rb
| @@ -47,6 +47,7 @@ describe Gitlab::API do | @@ -47,6 +47,7 @@ describe Gitlab::API do | ||
| 47 | response.status.should == 401 | 47 | response.status.should == 401 |
| 48 | end | 48 | end |
| 49 | end | 49 | end |
| 50 | + | ||
| 50 | context "when authenticated" do | 51 | context "when authenticated" do |
| 51 | it "should return array of ssh keys" do | 52 | it "should return array of ssh keys" do |
| 52 | user.keys << key | 53 | user.keys << key |
| @@ -67,6 +68,7 @@ describe Gitlab::API do | @@ -67,6 +68,7 @@ describe Gitlab::API do | ||
| 67 | response.status.should == 200 | 68 | response.status.should == 200 |
| 68 | json_response["title"].should == key.title | 69 | json_response["title"].should == key.title |
| 69 | end | 70 | end |
| 71 | + | ||
| 70 | it "should return 404 Not Found within invalid ID" do | 72 | it "should return 404 Not Found within invalid ID" do |
| 71 | get api("/user/keys/42", user) | 73 | get api("/user/keys/42", user) |
| 72 | response.status.should == 404 | 74 | response.status.should == 404 |
| @@ -78,6 +80,7 @@ describe Gitlab::API do | @@ -78,6 +80,7 @@ describe Gitlab::API do | ||
| 78 | post api("/user/keys", user), { title: "invalid key" } | 80 | post api("/user/keys", user), { title: "invalid key" } |
| 79 | response.status.should == 404 | 81 | response.status.should == 404 |
| 80 | end | 82 | end |
| 83 | + | ||
| 81 | it "should create ssh key" do | 84 | it "should create ssh key" do |
| 82 | key_attrs = Factory.attributes :key | 85 | key_attrs = Factory.attributes :key |
| 83 | expect { | 86 | expect { |
| @@ -94,6 +97,7 @@ describe Gitlab::API do | @@ -94,6 +97,7 @@ describe Gitlab::API do | ||
| 94 | delete api("/user/keys/#{key.id}", user) | 97 | delete api("/user/keys/#{key.id}", user) |
| 95 | }.to change{user.keys.count}.by(-1) | 98 | }.to change{user.keys.count}.by(-1) |
| 96 | end | 99 | end |
| 100 | + | ||
| 97 | it "should return 404 Not Found within invalid ID" do | 101 | it "should return 404 Not Found within invalid ID" do |
| 98 | delete api("/user/keys/42", user) | 102 | delete api("/user/keys/42", user) |
| 99 | response.status.should == 404 | 103 | response.status.should == 404 |