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

Version Path
graphql_scaffold_fan-0.2.2 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.2.1 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.2.0 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.9 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.8 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.7 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.6 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.5 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.4 lib/generators/templates/mutation_create_test.haml
graphql_scaffold_fan-0.1.3 lib/generators/templates/mutation_create_test.haml