gitlab-org--gitlab-foss/spec/requests/api/namespaces_spec.rb

28 lines
697 B
Ruby
Raw Normal View History

require 'spec_helper'
2014-04-11 19:45:56 +00:00
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")
response.status.should == 401
end
end
context "when authenticated as admin" do
it "admin: should return an array of all namespaces" do
get api("/namespaces", admin)
response.status.should == 200
json_response.should be_an Array
2014-10-06 08:19:11 +00:00
json_response.length.should == Namespace.count
end
end
end
end