lib/fdoc/spec_watcher.rb in fdoc-0.2.6 vs lib/fdoc/spec_watcher.rb in fdoc-0.2.7

- old
+ new

@@ -29,18 +29,26 @@ end opts.merge!(options) opts[:fdoc] end + real_response = if respond_to? :response + # we are on rails + response + else + # we are on sinatra + last_response + end + if path response_params = begin - JSON.parse(response.body) + JSON.parse(real_response.body) rescue {} end - successful = Fdoc.decide_success(response_params, response.status) + successful = Fdoc.decide_success(response_params, real_response.status) Service.verify!(verb, path, request_params, response_params, - response.status, successful) + real_response.status, successful) end result end end