Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql-ruby: Fix tests, grammar fixes, rewording #1432

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions content/backend/graphql-ruby/4-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Then create a mutation for creating a user:
```ruby(path=".../graphql-ruby/app/graphql/mutations/create_user.rb")
module Mutations
class CreateUser < BaseMutation
# often we will need input types for specific mutation
# often we will need input types for a specific mutation
# in those cases we can define those input types in the mutation class itself
class AuthProviderSignupData < Types::BaseInputObject
argument :credentials, Types::AuthProviderCredentialsInput, required: false
Expand Down Expand Up @@ -184,7 +184,7 @@ require 'test_helper'

class Mutations::CreateUserTest < ActiveSupport::TestCase
def perform(args = {})
Mutations::CreateUser.new(object: nil, field: nil, context: {}).resolve(args)
Mutations::CreateUser.new(object: nil, field: nil, context: {}).resolve(**args)
end

test 'create new user' do
Expand Down Expand Up @@ -288,7 +288,7 @@ require 'test_helper'

class Mutations::SignInUserTest < ActiveSupport::TestCase
def perform(args = {})
Mutations::SignInUser.new(object: nil, field: nil, context: { session: {} }).resolve(args)
Mutations::SignInUser.new(object: nil, field: nil, context: { session: {} }).resolve(**args)
end

def create_user
Expand Down Expand Up @@ -346,7 +346,7 @@ You'll need that object to be different in every request now though, since each

<Instruction>

Thankfully, the [graphql gem](https://rubygems.org/gems/graphql) allows that you'll just have to change the auto-generated `graphql_controller.rb` to accomplish this:
Thankfully, the [graphql gem](https://rubygems.org/gems/graphql) allows that. You'll just have to change the auto-generated `graphql_controller.rb` to accomplish this:

```ruby(path=".../graphql-ruby/app/controllers/graphql_controller.rb")
class GraphqlController < ApplicationController
Expand Down Expand Up @@ -426,7 +426,7 @@ This is pretty straightforward since the generated token is so simple. Like was

<Instruction>

Your server can now detect the user that triggered each GraphQL request. This could be useful in many situations. For example, the authenticated user should be exactly the one that posted a link being created with the `createLink` mutation. You can now store this information for each link.
Your server can now detect the user that triggered each GraphQL request. This could be useful in many situations. For example, the authenticated user should be the exact same user that's posting a link being created with the `createLink` mutation. You can now store this information for each link.

First run the following script:

Expand Down