Class: Contracto::RSpec::JsonHelper::Response
- Inherits:
-
Object
- Object
- Contracto::RSpec::JsonHelper::Response
- Defined in:
- lib/contracto/rspec/json_helper.rb
Instance Method Summary collapse
-
#initialize(body, options = {}) ⇒ Response
constructor
A new instance of Response.
- #parse_json_with_options ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(body, options = {}) ⇒ Response
Returns a new instance of Response.
25 26 27 28 |
# File 'lib/contracto/rspec/json_helper.rb', line 25 def initialize(body, = {}) @body = body = end |
Instance Method Details
#parse_json_with_options ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/contracto/rspec/json_helper.rb', line 38 def if [:ignore] if @json.is_a?(Array) @json.each do |json| [:ignore].each do |key| json.delete(key.to_s) end end else [:ignore].each do |key| @json.delete(key.to_s) end end end end |
#to_json ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/contracto/rspec/json_helper.rb', line 30 def to_json JSON.parse(@body).tap do |json| @json = json end @json end |