Sha256: d7c03af05d9c2dac48673d6f7d051c7cb6fe9d9fd9ab51ac656f095af88b3ecd

Contents?: true

Size: 798 Bytes

Versions: 22

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"
require "generators/graphql/function_generator"

class GraphQLGeneratorsFunctionGeneratorTest < BaseGeneratorTest
  tests Graphql::Generators::FunctionGenerator

  test "it generates an empty function by name" do
    run_generator(["FindRecord"])

    expected_content = <<-RUBY
class Functions::FindRecord < GraphQL::Function
  # Define `initialize` to store field-level options, eg
  #
  #     field :myField, function: Functions::FindRecord.new(type: MyType)
  #
  # attr_reader :type
  # def initialize(type:)
  #   @type = type
  # end

  # add arguments by type:
  # argument :id, !types.ID

  # Resolve function:
  def call(obj, args, ctx)
  end
end
RUBY

    assert_file "app/graphql/functions/find_record.rb", expected_content
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
graphql-1.8.0.pre1 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.6 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.5 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.4 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.3 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.2 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.1 spec/generators/graphql/function_generator_spec.rb
graphql-1.7.0 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.8 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.7 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.6 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.5 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.4 spec/generators/graphql/function_generator_spec.rb
graphql-1.5.15 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.3 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.2 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.1 spec/generators/graphql/function_generator_spec.rb
graphql-1.6.0 spec/generators/graphql/function_generator_spec.rb
graphql-1.5.14 spec/generators/graphql/function_generator_spec.rb
graphql-1.5.13 spec/generators/graphql/function_generator_spec.rb