Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-05 10:23:33 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-07-05 10:23:33 +0300
commitd89277c3579b245a6d7c220d8007ae35a990b1da (patch)
treee40124eaee4fab002b16ea809d026dd5205db0cf /spec/policies
parent2afa90b64a01eaefafacabb1f048835858ece15c (diff)
parent5af1fcd6f329858d757bab0d67cb50af6c820160 (diff)
Merge remote-tracking branch 'upstream/master' into 30634-protected-pipeline
* upstream/master: (67 commits) Revert "Merge branch 'revert-12499' into 'master'" Prevent accidental deletion of protected MR source branch by repeating checks before actual deletion Document that GitLab 9.3 requires the TRIGGER permission on MySQL Instrument Unicorn with Ruby exporter Remove group modal like remove project modal. Closes #33130 Update prometheus client gem Enables the option in user preferences to turn on the new navigation Simplify authentication logic in the v4 users API for !12445. wait_for_requests is not needed when AJAX is not in play Don't resolve fork relationships for projects pending delete Clean up the ForkedProjectLink specs Remove unnecessary clear_stubs calls Add test for GitalyClient::Ref#find_ref_name DeleteMergedBranchesService should not delete protected branches Optimize creation of commit API by using Repository#commit instead of Repository#commits Update CHANGELOG.md for 9.3.4 Make autosize fields more performant and remove broken autosize handle Update GITLAB_SHELL_VERSION to 5.1.1 Fixed the y_label not setting correctly for each graph on the monitoring dashboard Refactor and copyedit "Using Docker images" docs ...
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/global_policy_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb
new file mode 100644
index 00000000000..bb0fa0c0e9c
--- /dev/null
+++ b/spec/policies/global_policy_spec.rb
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+describe GlobalPolicy, models: true do
+ let(:current_user) { create(:user) }
+ let(:user) { create(:user) }
+
+ subject { GlobalPolicy.new(current_user, [user]) }
+
+ describe "reading the list of users" do
+ context "for a logged in user" do
+ it { is_expected.to be_allowed(:read_users_list) }
+ end
+
+ context "for an anonymous user" do
+ let(:current_user) { nil }
+
+ context "when the public level is restricted" do
+ before do
+ stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
+ end
+
+ it { is_expected.not_to be_allowed(:read_users_list) }
+ end
+
+ context "when the public level is not restricted" do
+ before do
+ stub_application_setting(restricted_visibility_levels: [])
+ end
+
+ it { is_expected.to be_allowed(:read_users_list) }
+ end
+ end
+ end
+end