gitlab-org--gitlab-foss/spec/policies/base_policy_spec.rb
Rémy Coutable 061bb6eb6e More improvements to presenters
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-18 16:38:35 +01:00

17 lines
461 B
Ruby

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)
end
it 'detects policy class for a presented subject' do
presentee = Ci::BuildPresenter.new(build)
expect(described_class.class_for(presentee)).to eq(Ci::BuildPolicy)
end
end
end