Module: RSpec::GraphqlIntegration
- Defined in:
- lib/rspec/graphql_integration/configuration.rb,
lib/rspec/graphql_integration/version.rb,
lib/rspec/graphql_integration/matchers/deep_eq.rb,
lib/rspec/graphql_integration/matchers/match_graphql_response.rb
Overview
This module sets up GraphQL integration testing for RSpec.
Defined Under Namespace
Modules: Matchers
Constant Summary collapse
- VERSION =
"0.2.0".freeze
Class Method Summary collapse
-
.initialize_configuration(config) ⇒ Object
rubocop:disable Metrics/MethodLength.
Class Method Details
.initialize_configuration(config) ⇒ Object
rubocop:disable Metrics/MethodLength
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec/graphql_integration/configuration.rb', line 5 def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength config.add_setting(:graphql_schema_class, default: nil) config.add_setting(:graphql_put_files_in_folder, default: false) config.include(RSpec::GraphqlIntegration::Matchers::DeepEq, type: :graphql) config.include(RSpec::GraphqlIntegration::Matchers::MatchGraphqlResponse, type: :graphql) config.instance_exec do # This method is inspired by the one from the RSpec::Rails gem. # See https://github.com/rspec/rspec-rails/blob/main/lib/rspec/rails/configuration.rb # => #infer_spec_type_from_file_location! # # It has to be called explicitly in the spec_helper.rb file to be enabled. # See the README for more information. def infer_graphql_spec_type_from_file_location! escaped_path = Regexp.compile("#{%w[spec graphql].join("[\\\\/]")}[\\/]") (file_path: escaped_path) do || [:type] ||= :graphql end end end end |