summaryrefslogtreecommitdiff
path: root/spec/requests/api/variables_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/variables_spec.rb')
-rw-r--r--spec/requests/api/variables_spec.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/requests/api/variables_spec.rb b/spec/requests/api/variables_spec.rb
index b1e1053d037..ddba18245f8 100644
--- a/spec/requests/api/variables_spec.rb
+++ b/spec/requests/api/variables_spec.rb
@@ -15,7 +15,7 @@ describe API::API, api: true do
it 'should return project variables' do
get api("/projects/#{project.id}/variables", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response).to be_a(Array)
end
end
@@ -24,7 +24,7 @@ describe API::API, api: true do
it 'should not return project variables' do
get api("/projects/#{project.id}/variables", user2)
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
@@ -32,7 +32,7 @@ describe API::API, api: true do
it 'should not return project variables' do
get api("/projects/#{project.id}/variables")
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end
@@ -42,14 +42,14 @@ describe API::API, api: true do
it 'should return project variable details' do
get api("/projects/#{project.id}/variables/#{variable.key}", user)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(json_response['value']).to eq(variable.value)
end
it 'should respond with 404 Not Found if requesting non-existing variable' do
get api("/projects/#{project.id}/variables/non_existing_variable", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -57,7 +57,7 @@ describe API::API, api: true do
it 'should not return project variable details' do
get api("/projects/#{project.id}/variables/#{variable.key}", user2)
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
@@ -65,7 +65,7 @@ describe API::API, api: true do
it 'should not return project variable details' do
get api("/projects/#{project.id}/variables/#{variable.key}")
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end
@@ -77,7 +77,7 @@ describe API::API, api: true do
post api("/projects/#{project.id}/variables", user), key: 'TEST_VARIABLE_2', value: 'VALUE_2'
end.to change{project.variables.count}.by(1)
- expect(response.status).to eq(201)
+ expect(response).to have_http_status(201)
expect(json_response['key']).to eq('TEST_VARIABLE_2')
expect(json_response['value']).to eq('VALUE_2')
end
@@ -87,7 +87,7 @@ describe API::API, api: true do
post api("/projects/#{project.id}/variables", user), key: variable.key, value: 'VALUE_2'
end.to change{project.variables.count}.by(0)
- expect(response.status).to eq(400)
+ expect(response).to have_http_status(400)
end
end
@@ -95,7 +95,7 @@ describe API::API, api: true do
it 'should not create variable' do
post api("/projects/#{project.id}/variables", user2)
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
@@ -103,7 +103,7 @@ describe API::API, api: true do
it 'should not create variable' do
post api("/projects/#{project.id}/variables")
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end
@@ -118,7 +118,7 @@ describe API::API, api: true do
updated_variable = project.variables.first
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
expect(value_before).to eq(variable.value)
expect(updated_variable.value).to eq('VALUE_1_UP')
end
@@ -126,7 +126,7 @@ describe API::API, api: true do
it 'should responde with 404 Not Found if requesting non-existing variable' do
put api("/projects/#{project.id}/variables/non_existing_variable", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -134,7 +134,7 @@ describe API::API, api: true do
it 'should not update variable' do
put api("/projects/#{project.id}/variables/#{variable.key}", user2)
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
@@ -142,7 +142,7 @@ describe API::API, api: true do
it 'should not update variable' do
put api("/projects/#{project.id}/variables/#{variable.key}")
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end
@@ -153,13 +153,13 @@ describe API::API, api: true do
expect do
delete api("/projects/#{project.id}/variables/#{variable.key}", user)
end.to change{project.variables.count}.by(-1)
- expect(response.status).to eq(200)
+ expect(response).to have_http_status(200)
end
it 'should responde with 404 Not Found if requesting non-existing variable' do
delete api("/projects/#{project.id}/variables/non_existing_variable", user)
- expect(response.status).to eq(404)
+ expect(response).to have_http_status(404)
end
end
@@ -167,7 +167,7 @@ describe API::API, api: true do
it 'should not delete variable' do
delete api("/projects/#{project.id}/variables/#{variable.key}", user2)
- expect(response.status).to eq(403)
+ expect(response).to have_http_status(403)
end
end
@@ -175,7 +175,7 @@ describe API::API, api: true do
it 'should not delete variable' do
delete api("/projects/#{project.id}/variables/#{variable.key}")
- expect(response.status).to eq(401)
+ expect(response).to have_http_status(401)
end
end
end