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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/types/diff_type_spec.rb')
-rw-r--r--spec/graphql/types/diff_type_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/graphql/types/diff_type_spec.rb b/spec/graphql/types/diff_type_spec.rb
new file mode 100644
index 00000000000..04f4ff9feed
--- /dev/null
+++ b/spec/graphql/types/diff_type_spec.rb
@@ -0,0 +1,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