diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 18:08:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 18:08:15 +0300 |
commit | c2b98d3dbd47ab92c79c702276fe9130d9a28036 (patch) | |
tree | bf4071f551fdc12c22b23b2bb66483064e7b9ea9 /spec/models/blob_spec.rb | |
parent | badb9c1deacbea601b02f88811b7e123589d9251 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/blob_spec.rb')
-rw-r--r-- | spec/models/blob_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index 9e55fbcce20..2c141cae98d 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -421,4 +421,21 @@ describe Blob do end end end + + describe 'policy' do + let(:project) { build(:project) } + subject { described_class.new(fake_blob(path: 'foo'), project) } + + it 'works with policy' do + expect(Ability.allowed?(project.creator, :read_blob, subject)).to be_truthy + end + + context 'when project is nil' do + subject { described_class.new(fake_blob(path: 'foo')) } + + it 'does not err' do + expect(Ability.allowed?(project.creator, :read_blob, subject)).to be_falsey + end + end + end end |