diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-03-01 13:05:04 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-03-06 12:30:35 +0300 |
commit | 50776d2d298c3b6c98e2531f116ca43ba10dcda4 (patch) | |
tree | 32e9e41dafa65c0ecff65fa941918e09d268f28c /spec/serializers/merge_request_for_pipeline_entity_spec.rb | |
parent | c9e5ce8dbd25203484b43c48f0a55a5d7bf396e8 (diff) |
Expose merge request entity for pipelines
Add preload
Fix
ok
Write tests
test only postgresql
ok
add more test
;
Improve wording
Add changelog
Fix
Diffstat (limited to 'spec/serializers/merge_request_for_pipeline_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_for_pipeline_entity_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/serializers/merge_request_for_pipeline_entity_spec.rb b/spec/serializers/merge_request_for_pipeline_entity_spec.rb new file mode 100644 index 00000000000..e49b45bc7d7 --- /dev/null +++ b/spec/serializers/merge_request_for_pipeline_entity_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe MergeRequestForPipelineEntity do + let(:project) { create(:project, :repository) } + let(:user) { create(:user) } + let(:request) { EntityRequest.new(project: project) } + let(:merge_request) { create(:merge_request, target_project: project, source_project: project) } + let(:presenter) { MergeRequestPresenter.new(merge_request, current_user: user) } + + let(:entity) do + described_class.new(presenter, request: request) + end + + before do + project.add_developer(user) + end + + context 'as json' do + subject { entity.as_json } + + it 'exposes needed attributes' do + expect(subject).to include( + :iid, :path, :title, + :source_branch, :source_branch_path, + :target_branch, :target_branch_path + ) + end + end +end |