Welcome to mirror list, hosted at ThFree Co, Russian Federation.

diff_type_spec.rb « types « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 04f4ff9feeda1b4bd4349d4fb62664763d9156df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe GitlabSchema.types['Diff'], feature_category: :code_review_workflow do
  include RepoHelpers
  include GraphqlHelpers

  specify { expect(described_class.graphql_name).to eq('Diff') }

  it 'contains attributes related to diff' do
    expect(described_class).to have_graphql_fields(
      :a_mode, :b_mode, :deleted_file, :diff, :new_file, :new_path, :old_path, :renamed_file
    )
  end

  describe '#diff' do
    subject { resolve_field(:diff, diff, object_type: described_class) }

    let(:merge_request_diff) { create(:merge_request).merge_request_diff }
    let(:diff) { merge_request_diff.diffs.diffs.first }

    it 'returns the diff of the passed commit' do
      is_expected.to eq(diff.diff)
    end
  end
end