class Contracto::RSpec::JsonHelper::Response
Public Class Methods
new(body, options = {})
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 25 def initialize(body, options = {}) @body = body @options = options end
Public Instance Methods
parse_json_with_options()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 38 def parse_json_with_options if @options[:ignore] if @json.is_a?(Array) @json.each do |json| @options[:ignore].each do |key| json.delete(key.to_s) end end else @options[:ignore].each do |key| @json.delete(key.to_s) end end end end
to_json()
click to toggle source
# File lib/contracto/rspec/json_helper.rb, line 30 def to_json JSON.parse(@body).tap do |json| @json = json parse_json_with_options end @json end