blob: 563c16a99dffe54ad05ec86b9996ee6535a97809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/graphql/gid_expected_type'
RSpec.describe RuboCop::Cop::Graphql::GIDExpectedType do
it 'adds an offense when there is no expected_type parameter' do
expect_offense(<<~TYPE)
GitlabSchema.object_from_id(received_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add an expected_type parameter to #object_from_id calls if possible.
TYPE
end
it 'does not add an offense for calls that have an expected_type parameter' do
expect_no_offenses(<<~TYPE.strip)
GitlabSchema.object_from_id("some_id", expected_type: SomeClass)
TYPE
end
end
|