debian-mirror-gitlab/spec/requests/api/namespaces_spec.rb

28 lines
716 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require 'spec_helper'
describe API::API, api: true do
include ApiHelpers
let(:admin) { create(:admin) }
let!(:group1) { create(:group) }
let!(:group2) { create(:group) }
describe "GET /namespaces" do
context "when unauthenticated" do
it "should return authentication error" do
get api("/namespaces")
2015-04-26 12:48:37 +05:30
expect(response.status).to eq(401)
2014-09-02 18:07:02 +05:30
end
end
context "when authenticated as admin" do
it "admin: should return an array of all namespaces" do
get api("/namespaces", admin)
2015-04-26 12:48:37 +05:30
expect(response.status).to eq(200)
expect(json_response).to be_an Array
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
expect(json_response.length).to eq(Namespace.count)
2014-09-02 18:07:02 +05:30
end
end
end
end