Sha256: ec75b91fb2d461736065aaaaedb97ad99523179df991b16cbf40407e9182db4a
Contents?: true
Size: 808 Bytes
Versions: 10
Compression:
Stored size: 808 Bytes
Contents
require 'rails_helper' RSpec.describe Mutations::Admin::<%= class_name %>s::Create<%= class_name %>, type: :request do let(:admin_user) { create(:admin_user) } describe '.resolve' do it 'should create' do variables = <<~GQL { } GQL expect do sign_in admin_user 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) data = json['data']['create<%= class_name %>'] end.to change { <%= class_name %>.count }.by(1) end end def query <<~GQL mutation create<%= class_name %>() { create<%= class_name %>(){ id } } GQL end end
Version data entries
10 entries across 10 versions & 1 rubygems