Sha256: 46a1d67ef4d81bdf26f84f9cc7d63cfc014be272ad91868bcd05afe17f431783

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

module MockGraphqlAi
  def self.add_mock_result_assignment(controller_file_path)
    file_contents = File.read(controller_file_path)
    modified_contents = file_contents.gsub(
      /(result\s*=\s*)GraphqlBoilerplateSchema\.execute\(query, variables: variables, context: @context, operation_name: operation_name\)/m,
      "result = ENV['GRAPHQL_MOCK_MODE'] ? Mocks::Resource.new({ query: query }).call : \\0"
    )

    File.write(controller_file_path, modified_contents)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mock_graphql_ai-1.0.0 lib/mock_graphql_ai.rb