class RSpec::GraphQLResponse::Validators::ValidationBase

Public Class Methods

failure_message(type, msg) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 6
def failure_message(type, msg)
  @messages ||= {}
  @messages[type] = msg
end
validate(&validate_method) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 11
def validate(&validate_method)
  @validate_method = validate_method
end
validate_negated(&validate_negated_method) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 15
def validate_negated(&validate_negated_method)
  @validate_negated_method = validate_negated_method
end

Public Instance Methods

failure_message(type) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 34
def failure_message(type)
  self.class.instance_variable_get(:@messages)[type]
end
validate(response, *args) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 20
def validate(response, *args)
  validate_method = self.class.instance_variable_get(:@validate_method)

  runner = ValidationRunner.new(self)
  runner.instance_exec(response, *args, &validate_method)
end
validate_negated(response, *args) click to toggle source
# File lib/rspec/graphql_response/validators/validation_base.rb, line 27
def validate_negated(response, *args)
  validate_negated_method = self.class.instance_variable_get(:@validate_negated_method)

  runner = ValidationRunner.new(self)
  runner.instance_exec(response, *args, &validate_negated_method)
end