2017-01-09 15:46:38 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::View::Presenter::Factory do
|
2017-01-10 17:41:04 -05:00
|
|
|
let(:build) { Ci::Build.new }
|
2017-01-09 15:46:38 -05:00
|
|
|
|
|
|
|
describe '#initialize' do
|
|
|
|
context 'without optional parameters' do
|
|
|
|
it 'takes a subject and optional params' do
|
2017-01-10 17:41:04 -05:00
|
|
|
presenter = described_class.new(build)
|
|
|
|
|
|
|
|
expect { presenter }.not_to raise_error
|
2017-01-09 15:46:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with optional parameters' do
|
|
|
|
it 'takes a subject and optional params' do
|
2017-01-10 17:41:04 -05:00
|
|
|
presenter = described_class.new(build, user: 'user')
|
|
|
|
|
|
|
|
expect { presenter }.not_to raise_error
|
2017-01-09 15:46:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#fabricate!' do
|
|
|
|
it 'detects the presenter based on the given subject' do
|
2017-01-10 17:41:04 -05:00
|
|
|
presenter = described_class.new(build).fabricate!
|
|
|
|
|
|
|
|
expect(presenter).to be_a(Ci::BuildPresenter)
|
2017-01-09 15:46:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|