blob: 57b98276622693f7760925f3f121f624e0983477 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
require 'spec_helper'
describe Gitlab::View::Presenter::Base do
let(:project) { double(:project) }
let(:presenter_class) do
Struct.new(:subject).include(described_class)
end
subject do
presenter_class.new(project)
end
describe '.presents' do
it 'exposes #subject with the given keyword' do
presenter_class.presents(:foo)
expect(subject.foo).to eq(project)
end
end
describe '#can?' do
let(:project) { create(:empty_project) }
context 'user is not allowed' do
it 'returns false' do
expect(subject.can?(nil, :read_project)).to be_falsy
end
end
context 'user is allowed' do
let(:project) { create(:empty_project, :public) }
it 'returns true' do
expect(subject.can?(nil, :read_project)).to be_truthy
end
end
end
end
|