Sha256: f4626d0130cc71a79a7a20ae62e2849dc6b0d32b9bc56c9e3ee122fdfe7b9697

Contents?: true

Size: 714 Bytes

Versions: 14

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_context 'with graphql query request' do
  let(:headers)   { {} }
  let(:variables) { {} }
  let(:graphql_params) do
    if Rails::VERSION::MAJOR >= 5
      { params: { query: query, variables: variables }, headers: headers }
    else
      [{ query: query, variables: variables }, headers]
    end
  end

  def post_request(path = '/api/v1/graphql_auth')
    send_request(path, :post)
  end

  def get_request(path = '/api/v1/graphql_auth')
    send_request(path, :get)
  end

  def send_request(path, method)
    if Rails::VERSION::MAJOR >= 5
      public_send(method, path, **graphql_params)
    else
      public_send(method, path, *graphql_params)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql_devise-1.4.0 spec/support/contexts/graphql_request.rb
graphql_devise-1.3.0 spec/support/contexts/graphql_request.rb
graphql_devise-1.2.0 spec/support/contexts/graphql_request.rb
graphql_devise-1.1.1 spec/support/contexts/graphql_request.rb
graphql_devise-1.1.0 spec/support/contexts/graphql_request.rb
graphql_devise-1.0.1 spec/support/contexts/graphql_request.rb
graphql_devise-1.0.0 spec/support/contexts/graphql_request.rb
graphql_devise-0.18.2 spec/support/contexts/graphql_request.rb
graphql_devise-0.18.1 spec/support/contexts/graphql_request.rb
graphql_devise-0.18.0 spec/support/contexts/graphql_request.rb
graphql_devise-0.17.1 spec/support/contexts/graphql_request.rb
graphql_devise-0.17.0 spec/support/contexts/graphql_request.rb
graphql_devise-0.16.0 spec/support/contexts/graphql_request.rb
graphql_devise-0.15.0 spec/support/contexts/graphql_request.rb