blob: 7a65429b500c42d426bca5e6cdad09f99fd8f7a0 (
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
39
40
41
42
|
require 'spec_helper'
describe Gitlab::View::Presenter::Factory do
let(:variable) { create(:ci_variable) }
describe '#initialize' do
context 'without optional parameters' do
subject do
described_class.new(variable)
end
it 'takes a subject and optional params' do
expect { subject }.not_to raise_error
end
end
context 'with optional parameters' do
subject do
described_class.new(variable, user: 'user')
end
it 'takes a subject and optional params' do
expect { subject }.not_to raise_error
end
end
end
describe '#fabricate!' do
subject do
described_class.new(variable, user: 'user', foo: 'bar').fabricate!
end
it 'exposes given params' do
expect(subject.user).to eq('user')
expect(subject.foo).to eq('bar')
end
it 'detects the presenter based on the given subject' do
expect(subject).to be_a(Ci::Variable::Presenter)
end
end
end
|