require'spec_helper'describeAPI::APIdoincludeApiHelpersbefore(:each){ActiveRecord::Base.observers.enable(:user_observer)}after(:each){ActiveRecord::Base.observers.disable(:user_observer)}let(:admin){create(:admin)}let!(:group1){create(:group)}let!(:group2){create(:group)}describe"GET /namespaces"docontext"when unauthenticated"doit"should return authentication error"dogetapi("/namespaces")response.status.should==401endendcontext"when authenticated as admin"doit"admin: should return an array of all namespaces"dogetapi("/namespaces",admin)response.status.should==200json_response.shouldbe_anArray# Admin namespace + 2 group namespacesjson_response.length.should==3endendendend