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:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-02-12 21:17:35 +0300
committerJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-02-12 21:17:35 +0300
commit0c4a70a306b871899bf87ce4673918abfee4d95f (patch)
treec7a702fb511209ffe0eceba245d1ffea71dce1aa /spec/requests/api/project_hooks_spec.rb
parentde1c450abd6b367390a1295cac402344f500d41d (diff)
Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Diffstat (limited to 'spec/requests/api/project_hooks_spec.rb')
-rw-r--r--spec/requests/api/project_hooks_spec.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/spec/requests/api/project_hooks_spec.rb b/spec/requests/api/project_hooks_spec.rb
index cdb5e3d0612..81fe68de662 100644
--- a/spec/requests/api/project_hooks_spec.rb
+++ b/spec/requests/api/project_hooks_spec.rb
@@ -16,18 +16,18 @@ describe API::API, 'ProjectHooks', api: true do
context "authorized user" do
it "should return project hooks" do
get api("/projects/#{project.id}/hooks", user)
- response.status.should == 200
+ expect(response.status).to eq(200)
- json_response.should be_an Array
- json_response.count.should == 1
- json_response.first['url'].should == "http://example.com"
+ expect(json_response).to be_an Array
+ expect(json_response.count).to eq(1)
+ expect(json_response.first['url']).to eq("http://example.com")
end
end
context "unauthorized user" do
it "should not access project hooks" do
get api("/projects/#{project.id}/hooks", user3)
- response.status.should == 403
+ expect(response.status).to eq(403)
end
end
end
@@ -36,26 +36,26 @@ describe API::API, 'ProjectHooks', api: true do
context "authorized user" do
it "should return a project hook" do
get api("/projects/#{project.id}/hooks/#{hook.id}", user)
- response.status.should == 200
- json_response['url'].should == hook.url
+ expect(response.status).to eq(200)
+ expect(json_response['url']).to eq(hook.url)
end
it "should return a 404 error if hook id is not available" do
get api("/projects/#{project.id}/hooks/1234", user)
- response.status.should == 404
+ expect(response.status).to eq(404)
end
end
context "unauthorized user" do
it "should not access an existing hook" do
get api("/projects/#{project.id}/hooks/#{hook.id}", user3)
- response.status.should == 403
+ expect(response.status).to eq(403)
end
end
it "should return a 404 error if hook id is not available" do
get api("/projects/#{project.id}/hooks/1234", user)
- response.status.should == 404
+ expect(response.status).to eq(404)
end
end
@@ -65,17 +65,17 @@ describe API::API, 'ProjectHooks', api: true do
post api("/projects/#{project.id}/hooks", user),
url: "http://example.com", issues_events: true
}.to change {project.hooks.count}.by(1)
- response.status.should == 201
+ expect(response.status).to eq(201)
end
it "should return a 400 error if url not given" do
post api("/projects/#{project.id}/hooks", user)
- response.status.should == 400
+ expect(response.status).to eq(400)
end
it "should return a 422 error if url not valid" do
post api("/projects/#{project.id}/hooks", user), "url" => "ftp://example.com"
- response.status.should == 422
+ expect(response.status).to eq(422)
end
end
@@ -83,23 +83,23 @@ describe API::API, 'ProjectHooks', api: true do
it "should update an existing project hook" do
put api("/projects/#{project.id}/hooks/#{hook.id}", user),
url: 'http://example.org', push_events: false
- response.status.should == 200
- json_response['url'].should == 'http://example.org'
+ expect(response.status).to eq(200)
+ expect(json_response['url']).to eq('http://example.org')
end
it "should return 404 error if hook id not found" do
put api("/projects/#{project.id}/hooks/1234", user), url: 'http://example.org'
- response.status.should == 404
+ expect(response.status).to eq(404)
end
it "should return 400 error if url is not given" do
put api("/projects/#{project.id}/hooks/#{hook.id}", user)
- response.status.should == 400
+ expect(response.status).to eq(400)
end
it "should return a 422 error if url is not valid" do
put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'ftp://example.com'
- response.status.should == 422
+ expect(response.status).to eq(422)
end
end
@@ -108,22 +108,22 @@ describe API::API, 'ProjectHooks', api: true do
expect {
delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
}.to change {project.hooks.count}.by(-1)
- response.status.should == 200
+ expect(response.status).to eq(200)
end
it "should return success when deleting hook" do
delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
- response.status.should == 200
+ expect(response.status).to eq(200)
end
it "should return success when deleting non existent hook" do
delete api("/projects/#{project.id}/hooks/42", user)
- response.status.should == 200
+ expect(response.status).to eq(200)
end
it "should return a 405 error if hook id not given" do
delete api("/projects/#{project.id}/hooks", user)
- response.status.should == 405
+ expect(response.status).to eq(405)
end
end
end