Class: RSpec::ComposableJSONMatchers::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/composable_json_matchers/configuration.rb

Constant Summary collapse

DEFAULT_PARSER_OPTIONS =

The default value of .parser_options.

See Also:

{ symbolize_names: true }.freeze

Instance Method Summary collapse

Instance Method Details

#parser_optionsHash

Returns the current options for JSON.parse used in the be_json matcher.

Returns:

  • (Hash)

    the current options for JSON.parse.

See Also:



19
20
21
# File 'lib/rspec/composable_json_matchers/configuration.rb', line 19

def parser_options
  @parser_options ||= DEFAULT_PARSER_OPTIONS
end

#parser_options=(hash)

This method returns an undefined value.

Set the given hash as the option for JSON.parse used in the be_json matcher.

Parameters:

  • hash (Hash)

    an option for JSON.parse

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
# File 'lib/rspec/composable_json_matchers/configuration.rb', line 33

def parser_options=(hash)
  raise ArgumentError, 'You must pass a hash to `parser_options=`.' unless hash.is_a?(Hash)
  @parser_options = hash
end