module RSpec::JsonHelpers

Provides a `equal_json` rspec matcher.

Public Class Methods

normalize_json(json) click to toggle source

@param [String<JSON>] json @return [String<JSON>] @raise ArgumentError Raises an ArgumentError when the given

value is not valid JSON. expected

@api private

# File lib/rspec/json_helpers.rb, line 24
def normalize_json(json)
  Formatter.new.format(json)
end

Public Instance Methods

equal_json(expected) click to toggle source

@param [String<JSON>] expected @raise ArgumentError Raises an ArgumentError when the expected

value is not a String that contains valid JSON.
# File lib/rspec/json_helpers.rb, line 13
def equal_json(expected)
  EqualJsonMatcher.new(expected)
end