commit
3643df1f7c
4 changed files with 122 additions and 0 deletions
|
@ -6,6 +6,7 @@ describe Gitlab::API do
|
|||
let(:user) { Factory :user }
|
||||
let(:user2) { Factory.create(:user) }
|
||||
let(:user3) { Factory.create(:user) }
|
||||
let!(:hook) { Factory :project_hook, project: project, url: "http://example.com" }
|
||||
let!(:project) { Factory :project, owner: user }
|
||||
let!(:snippet) { Factory :snippet, author: user, project: project, title: 'example' }
|
||||
let!(:users_project) { Factory :users_project, user: user, project: project, project_access: UsersProject::MASTER }
|
||||
|
@ -149,6 +150,36 @@ describe Gitlab::API do
|
|||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/:id/hooks" do
|
||||
it "should return project hooks" do
|
||||
get api("/projects/#{project.code}/hooks", user)
|
||||
|
||||
response.status.should == 200
|
||||
|
||||
json_response.should be_an Array
|
||||
json_response.count.should == 1
|
||||
json_response.first['url'].should == "http://example.com"
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /projects/:id/users" do
|
||||
it "should add hook to project" do
|
||||
expect {
|
||||
post api("/projects/#{project.code}/hooks", user),
|
||||
"url" => "http://example.com"
|
||||
}.to change {project.hooks.count}.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE /projects/:id/hooks" do
|
||||
it "should delete hook from project" do
|
||||
expect {
|
||||
delete api("/projects/#{project.code}/hooks", user),
|
||||
hook_id: hook.id
|
||||
}.to change {project.hooks.count}.by(-1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/:id/repository/tags" do
|
||||
it "should return an array of project tags" do
|
||||
get api("/projects/#{project.code}/repository/tags", user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue