Change single quotes to double quotes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe GraphQL::ApiTypesCreator do
|
||||
let(:created_types) { {} }
|
||||
@@ -6,53 +6,53 @@ describe GraphQL::ApiTypesCreator do
|
||||
describe "::create_type" do
|
||||
it "creates fields for Int attributes" do
|
||||
debate_type = described_class.create_type(Debate, { id: :integer }, created_types)
|
||||
created_field = debate_type.fields['id']
|
||||
created_field = debate_type.fields["id"]
|
||||
|
||||
expect(created_field).to be_a(GraphQL::Field)
|
||||
expect(created_field.type).to be_a(GraphQL::ScalarType)
|
||||
expect(created_field.type.name).to eq('Int')
|
||||
expect(created_field.type.name).to eq("Int")
|
||||
end
|
||||
|
||||
it "creates fields for String attributes" do
|
||||
debate_type = described_class.create_type(Debate, { title: :string }, created_types)
|
||||
created_field = debate_type.fields['title']
|
||||
created_field = debate_type.fields["title"]
|
||||
|
||||
expect(created_field).to be_a(GraphQL::Field)
|
||||
expect(created_field.type).to be_a(GraphQL::ScalarType)
|
||||
expect(created_field.type.name).to eq('String')
|
||||
expect(created_field.type.name).to eq("String")
|
||||
end
|
||||
|
||||
it "creates connections for :belongs_to associations" do
|
||||
user_type = described_class.create_type(User, { id: :integer }, created_types)
|
||||
debate_type = described_class.create_type(Debate, { author: User }, created_types)
|
||||
|
||||
connection = debate_type.fields['author']
|
||||
connection = debate_type.fields["author"]
|
||||
|
||||
expect(connection).to be_a(GraphQL::Field)
|
||||
expect(connection.type).to eq(user_type)
|
||||
expect(connection.name).to eq('author')
|
||||
expect(connection.name).to eq("author")
|
||||
end
|
||||
|
||||
it "creates connections for :has_one associations" do
|
||||
user_type = described_class.create_type(User, { organization: Organization }, created_types)
|
||||
organization_type = described_class.create_type(Organization, { id: :integer }, created_types)
|
||||
|
||||
connection = user_type.fields['organization']
|
||||
connection = user_type.fields["organization"]
|
||||
|
||||
expect(connection).to be_a(GraphQL::Field)
|
||||
expect(connection.type).to eq(organization_type)
|
||||
expect(connection.name).to eq('organization')
|
||||
expect(connection.name).to eq("organization")
|
||||
end
|
||||
|
||||
it "creates connections for :has_many associations" do
|
||||
comment_type = described_class.create_type(Comment, { id: :integer }, created_types)
|
||||
debate_type = described_class.create_type(Debate, { comments: [Comment] }, created_types)
|
||||
|
||||
connection = debate_type.fields['comments']
|
||||
connection = debate_type.fields["comments"]
|
||||
|
||||
expect(connection).to be_a(GraphQL::Field)
|
||||
expect(connection.type).to eq(comment_type.connection_type)
|
||||
expect(connection.name).to eq('comments')
|
||||
expect(connection.name).to eq("comments")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
describe GraphQL::QueryTypeCreator do
|
||||
let(:api_type_definitions) do
|
||||
@@ -12,24 +12,24 @@ describe GraphQL::QueryTypeCreator do
|
||||
describe "::create" do
|
||||
let(:query_type) { described_class.create(api_types) }
|
||||
|
||||
it 'creates a QueryType with fields to retrieve single objects whose model fields included an ID' do
|
||||
field = query_type.fields['proposal']
|
||||
it "creates a QueryType with fields to retrieve single objects whose model fields included an ID" do
|
||||
field = query_type.fields["proposal"]
|
||||
|
||||
expect(field).to be_a(GraphQL::Field)
|
||||
expect(field.type).to eq(api_types[Proposal])
|
||||
expect(field.name).to eq('proposal')
|
||||
expect(field.name).to eq("proposal")
|
||||
end
|
||||
|
||||
it 'creates a QueryType without fields to retrieve single objects whose model fields did not include an ID' do
|
||||
expect(query_type.fields['proposal_notification']).to be_nil
|
||||
it "creates a QueryType without fields to retrieve single objects whose model fields did not include an ID" do
|
||||
expect(query_type.fields["proposal_notification"]).to be_nil
|
||||
end
|
||||
|
||||
it "creates a QueryType with connections to retrieve collections of objects" do
|
||||
connection = query_type.fields['proposals']
|
||||
connection = query_type.fields["proposals"]
|
||||
|
||||
expect(connection).to be_a(GraphQL::Field)
|
||||
expect(connection.type).to eq(api_types[Proposal].connection_type)
|
||||
expect(connection.name).to eq('proposals')
|
||||
expect(connection.name).to eq("proposals")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user