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/issuable_type_spec.rb')
-rw-r--r--spec/graphql/types/issuable_type_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/graphql/types/issuable_type_spec.rb b/spec/graphql/types/issuable_type_spec.rb
new file mode 100644
index 00000000000..992a58f524b
--- /dev/null
+++ b/spec/graphql/types/issuable_type_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['Issuable'] do
+ it 'returns possible types' do
+ expect(described_class.possible_types).to include(Types::IssueType, Types::MergeRequestType)
+ end
+
+ describe '.resolve_type' do
+ it 'resolves issues' do
+ expect(described_class.resolve_type(build(:issue), {})).to eq(Types::IssueType)
+ end
+
+ it 'resolves merge requests' do
+ expect(described_class.resolve_type(build(:merge_request), {})).to eq(Types::MergeRequestType)
+ end
+
+ it 'raises an error for invalid types' do
+ expect { described_class.resolve_type(build(:user), {}) }.to raise_error 'Unsupported issuable type'
+ end
+ end
+end