# frozen_string_literal: true require 'rails_helper' RSpec.describe Types::Admin::<%= class_name %>Type, type: :request do let(:query) do <<-GRAPHQL query all<%= class_name %>s($filter: <%= class_name %>Filter, $page: Int, $perPage: Int, $sortField: String, $sortOrder: String) { all<%= class_name %>s(filter: $filter, page: $page, perPage: $perPage, sortField: $sortField, sortOrder: $sortOrder){ id } } GRAPHQL end let(:admin_user) { create :admin_user } describe '#resolve' do it 'pass' do variables = <<~GQL { "filter": {} } GQL post '/api/admin/graphql', headers: admin_user.create_new_auth_token, params: { query: query, variables: variables } expect(response).to have_http_status(:success) json = JSON.parse(response.body) expect(json['data']['all<%= class_name %>s'].first['id']).to eq end end end