diff options
author | Felipe Artur <fcardozo@gitlab.com> | 2018-06-21 15:22:40 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-06-21 15:22:40 +0300 |
commit | 3e66795ef1ff1228906239763910b051d8afcc37 (patch) | |
tree | df6424d9ec008f5d1da455f8465681b371c4a11e /spec/serializers/diffs_entity_spec.rb | |
parent | 14e35ac9b19d358d84e0cfd167f74036937285b6 (diff) |
Changes tab VUE refactoring
Diffstat (limited to 'spec/serializers/diffs_entity_spec.rb')
-rw-r--r-- | spec/serializers/diffs_entity_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/serializers/diffs_entity_spec.rb b/spec/serializers/diffs_entity_spec.rb new file mode 100644 index 00000000000..19a843b0cb7 --- /dev/null +++ b/spec/serializers/diffs_entity_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe DiffsEntity do + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + let(:request) { EntityRequest.new(project: project, current_user: user) } + let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } + let(:merge_request_diffs) { merge_request.merge_request_diffs } + + let(:entity) do + described_class.new(merge_request_diffs.first.diffs, request: request, merge_request: merge_request, merge_request_diffs: merge_request_diffs) + end + + context 'as json' do + subject { entity.as_json } + + it 'contains needed attributes' do + expect(subject).to include( + :real_size, :size, :branch_name, + :target_branch_name, :commit, :merge_request_diff, + :start_version, :latest_diff, :latest_version_path, + :added_lines, :removed_lines, :render_overflow_warning, + :email_patch_path, :plain_diff_path, :diff_files, + :merge_request_diffs + ) + end + end +end |