diff options
author | Rémy Coutable <remy@rymai.me> | 2017-01-06 12:30:19 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-01-18 16:38:34 +0100 |
commit | b4f67cc2294f262d35fe63cc1e60eccebc4667ac (patch) | |
tree | 34b125dee583f517f4fe4d8e6e0148d06a3f68fc /spec/presenters | |
parent | 5e9196b3bcc31ce7fd698ed49af5d39eae1da630 (diff) | |
download | gitlab-ce-b4f67cc2294f262d35fe63cc1e60eccebc4667ac.tar.gz |
Document presenters
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/build_presenter_spec.rb | 35 | ||||
-rw-r--r-- | spec/presenters/variable_presenter_spec.rb | 23 |
2 files changed, 58 insertions, 0 deletions
diff --git a/spec/presenters/build_presenter_spec.rb b/spec/presenters/build_presenter_spec.rb new file mode 100644 index 00000000000..fa7b0567622 --- /dev/null +++ b/spec/presenters/build_presenter_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe BuildPresenter do + let(:build) { create(:ci_build) } + subject do + described_class.new(build).with_subject(build) + end + + describe '#initialize' do + it 'takes a build and optional params' do + expect { subject }. + not_to raise_error + end + + it 'exposes build' do + expect(subject.build).to eq(build) + end + + it 'forwards missing methods to build' do + expect(subject.ref).to eq('master') + end + end + + describe '#erased_by_user?' do + it 'takes a build and optional params' do + expect(subject).not_to be_erased_by_user + end + end + + describe 'quack like a Ci::Build' do + it 'takes a build and optional params' do + expect(described_class.ancestors).to include(Ci::Build) + end + end +end diff --git a/spec/presenters/variable_presenter_spec.rb b/spec/presenters/variable_presenter_spec.rb new file mode 100644 index 00000000000..f09a0c922ae --- /dev/null +++ b/spec/presenters/variable_presenter_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe VariablePresenter do + let(:variable) { double(:variable, foo: 'bar') } + subject do + described_class.new.with_subject(variable) + end + + describe '#initialize' do + it 'takes a variable and optional params' do + expect { subject }. + not_to raise_error + end + + it 'exposes variable' do + expect(subject.variable).to eq(variable) + end + + it 'does not forward missing methods to variable' do + expect { subject.foo }.to raise_error(NoMethodError) + end + end +end |