module RspecContracts

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/rspec_contracts.rb, line 22
def self.config
  @config ||= ActiveSupport::OrderedOptions.new
end
install() click to toggle source
# File lib/rspec_contracts.rb, line 26
def self.install
  ActiveSupport.on_load(:action_dispatch_integration_test) do
    include RspecContracts::Integration
  end

  RspecContracts.config.base_path ||= ""
  RspecContracts.config.request_validation_mode ||= :raise
  RspecContracts.config.response_validation_mode ||= :raise
  RspecContracts.config.path_validation_mode ||= :raise
  RspecContracts.config.strict_response_validation ||= true
  RspecContracts.config.logger ||= Logger.new("log/rspec_contracts.log")
end
valid_json?(json) click to toggle source
# File lib/rspec_contracts.rb, line 39
def self.valid_json?(json)
  JSON.parse(json.to_s)
  true
rescue JSON::ParserError => _e
  false
end