require'spec_helper'describeGlobalPolicy,models: truedolet(:current_user){create(:user)}let(:user){create(:user)}subject{GlobalPolicy.new(current_user,[user])}describe"reading the list of users"docontext"for a logged in user"doit{is_expected.tobe_allowed(:read_users_list)}endcontext"for an anonymous user"dolet(:current_user){nil}context"when the public level is restricted"dobeforedostub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])endit{is_expected.not_tobe_allowed(:read_users_list)}endcontext"when the public level is not restricted"dobeforedostub_application_setting(restricted_visibility_levels: [])endit{is_expected.tobe_allowed(:read_users_list)}endendendend