diff options
author | http://jneen.net/ <jneen@jneen.net> | 2017-03-02 17:49:23 -0800 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2017-03-09 11:49:53 -0800 |
commit | 275a46c52338ab3bfb4da73431465d742060e3ea (patch) | |
tree | 52f3c4971d455cf225a0dea39f8d7f06ed544b71 /spec/policies | |
parent | f1d3a92bd64e9a503335d089057cca559a74b5ef (diff) | |
download | gitlab-ce-275a46c52338ab3bfb4da73431465d742060e3ea.tar.gz |
spec the new behavior of .class_for
and more robustly spec the ancestor behavior
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/base_policy_spec.rb | 10 |
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 |