diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-05-09 07:15:34 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2017-05-09 07:15:34 +0300 |
commit | 0151325dacebb99d54b6effb1d5842c0c712168c (patch) | |
tree | 767ea3c8cfeedab5a0ce1921d5842b149ea7c0be /spec/serializers/merge_request_serializer_spec.rb | |
parent | 9ada13d343a4736275d2c026ee980abe5c5e5763 (diff) |
Merge request widget redesign
Diffstat (limited to 'spec/serializers/merge_request_serializer_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_serializer_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/serializers/merge_request_serializer_spec.rb b/spec/serializers/merge_request_serializer_spec.rb new file mode 100644 index 00000000000..73fbecc153d --- /dev/null +++ b/spec/serializers/merge_request_serializer_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +describe MergeRequestSerializer do + let(:user) { build_stubbed(:user) } + let(:merge_request) { build_stubbed(:merge_request) } + + let(:serializer) do + described_class.new(current_user: user) + end + + describe '#represent' do + let(:opts) { { basic: basic } } + subject { serializer.represent(merge_request, basic: basic) } + + context 'when basic param is truthy' do + let(:basic) { true } + + it 'calls super class #represent with correct params' do + expect_any_instance_of(BaseSerializer).to receive(:represent) + .with(merge_request, opts, MergeRequestBasicEntity) + + subject + end + end + + context 'when basic param is falsy' do + let(:basic) { false } + + it 'calls super class #represent with correct params' do + expect_any_instance_of(BaseSerializer).to receive(:represent) + .with(merge_request, opts, MergeRequestEntity) + + subject + end + end + end +end |