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:
authorhttp://jneen.net/ <jneen@jneen.net>2017-03-03 04:49:23 +0300
committerhttp://jneen.net/ <jneen@jneen.net>2017-03-09 22:49:53 +0300
commit275a46c52338ab3bfb4da73431465d742060e3ea (patch)
tree52f3c4971d455cf225a0dea39f8d7f06ed544b71 /spec/policies/base_policy_spec.rb
parentf1d3a92bd64e9a503335d089057cca559a74b5ef (diff)
spec the new behavior of .class_for
and more robustly spec the ancestor behavior
Diffstat (limited to 'spec/policies/base_policy_spec.rb')
-rw-r--r--spec/policies/base_policy_spec.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/policies/base_policy_spec.rb b/spec/policies/base_policy_spec.rb
index 63acc0b68cd..02acdcb36df 100644
--- a/spec/policies/base_policy_spec.rb
+++ b/spec/policies/base_policy_spec.rb
@@ -1,17 +1,19 @@
require 'spec_helper'
describe BasePolicy, models: true do
- let(:build) { Ci::Build.new }
-
describe '.class_for' do
it 'detects policy class based on the subject ancestors' do
- expect(described_class.class_for(build)).to eq(Ci::BuildPolicy)
+ expect(described_class.class_for(GenericCommitStatus.new)).to eq(CommitStatusPolicy)
end
it 'detects policy class for a presented subject' do
- presentee = Ci::BuildPresenter.new(build)
+ presentee = Ci::BuildPresenter.new(Ci::Build.new)
expect(described_class.class_for(presentee)).to eq(Ci::BuildPolicy)
end
+
+ it 'uses GlobalPolicy when :global is given' do
+ expect(described_class.class_for(:global)).to eq(GlobalPolicy)
+ end
end
end