Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kumanyaev <me@zzet.org>2013-03-21 01:46:30 +0400
committerAndrey Kumanyaev <me@zzet.org>2013-05-05 18:02:02 +0400
commitb1b354b0f86daae9a2cf19869dd3e6cb2d9ffd5e (patch)
tree237608f2f66462280134f7bf6f4e9ba8b571bfa0 /spec/requests/api/system_hooks_spec.rb
parent67ccc8b52aceebea9c0cb22b3277daf0b467c78e (diff)
remove trailing spaces
Diffstat (limited to 'spec/requests/api/system_hooks_spec.rb')
-rw-r--r--spec/requests/api/system_hooks_spec.rb162
1 files changed, 81 insertions, 81 deletions
diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb
index fe1b324c921..647e31ce034 100644
--- a/spec/requests/api/system_hooks_spec.rb
+++ b/spec/requests/api/system_hooks_spec.rb
@@ -1,81 +1,81 @@
-require 'spec_helper'
-
-describe Gitlab::API do
- include ApiHelpers
-
- let(:user) { create(:user) }
- let(:admin) { create(:admin) }
- let!(:hook) { create(:system_hook, url: "http://example.com") }
-
- before { stub_request(:post, hook.url) }
-
- describe "GET /hooks" do
- context "when no user" do
- it "should return authentication error" do
- get api("/hooks")
- response.status.should == 401
- end
- end
-
- context "when not an admin" do
- it "should return forbidden error" do
- get api("/hooks", user)
- response.status.should == 403
- end
- end
-
- context "when authenticated as admin" do
- it "should return an array of hooks" do
- get api("/hooks", admin)
- response.status.should == 200
- json_response.should be_an Array
- json_response.first['url'].should == hook.url
- end
- end
- end
-
- describe "POST /hooks" do
- it "should create new hook" do
- expect {
- post api("/hooks", admin), url: 'http://example.com'
- }.to change { SystemHook.count }.by(1)
- end
-
- it "should respond with 400 if url not given" do
- post api("/hooks", admin)
- response.status.should == 400
- end
-
- it "should not create new hook without url" do
- expect {
- post api("/hooks", admin)
- }.to_not change { SystemHook.count }
- end
- end
-
- describe "GET /hooks/:id" do
- it "should return hook by id" do
- get api("/hooks/#{hook.id}", admin)
- response.status.should == 200
- json_response['event_name'].should == 'project_create'
- end
-
- it "should return 404 on failure" do
- get api("/hooks/404", admin)
- response.status.should == 404
- end
- end
-
- describe "DELETE /hooks/:id" do
- it "should delete a hook" do
- expect {
- delete api("/hooks/#{hook.id}", admin)
- }.to change { SystemHook.count }.by(-1)
- end
-
- it "should return success if hook id not found" do
- delete api("/hooks/12345", admin)
- response.status.should == 200
- end
- end
-end \ No newline at end of file
+require 'spec_helper'
+
+describe Gitlab::API do
+ include ApiHelpers
+
+ let(:user) { create(:user) }
+ let(:admin) { create(:admin) }
+ let!(:hook) { create(:system_hook, url: "http://example.com") }
+
+ before { stub_request(:post, hook.url) }
+
+ describe "GET /hooks" do
+ context "when no user" do
+ it "should return authentication error" do
+ get api("/hooks")
+ response.status.should == 401
+ end
+ end
+
+ context "when not an admin" do
+ it "should return forbidden error" do
+ get api("/hooks", user)
+ response.status.should == 403
+ end
+ end
+
+ context "when authenticated as admin" do
+ it "should return an array of hooks" do
+ get api("/hooks", admin)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.first['url'].should == hook.url
+ end
+ end
+ end
+
+ describe "POST /hooks" do
+ it "should create new hook" do
+ expect {
+ post api("/hooks", admin), url: 'http://example.com'
+ }.to change { SystemHook.count }.by(1)
+ end
+
+ it "should respond with 400 if url not given" do
+ post api("/hooks", admin)
+ response.status.should == 400
+ end
+
+ it "should not create new hook without url" do
+ expect {
+ post api("/hooks", admin)
+ }.to_not change { SystemHook.count }
+ end
+ end
+
+ describe "GET /hooks/:id" do
+ it "should return hook by id" do
+ get api("/hooks/#{hook.id}", admin)
+ response.status.should == 200
+ json_response['event_name'].should == 'project_create'
+ end
+
+ it "should return 404 on failure" do
+ get api("/hooks/404", admin)
+ response.status.should == 404
+ end
+ end
+
+ describe "DELETE /hooks/:id" do
+ it "should delete a hook" do
+ expect {
+ delete api("/hooks/#{hook.id}", admin)
+ }.to change { SystemHook.count }.by(-1)
+ end
+
+ it "should return success if hook id not found" do
+ delete api("/hooks/12345", admin)
+ response.status.should == 200
+ end
+ end
+end