lib/fdoc/spec_watcher.rb in fdoc-0.2.4 vs lib/fdoc/spec_watcher.rb in fdoc-0.2.5

- old
+ new

@@ -3,10 +3,20 @@ VERBS = [:get, :post, :put, :delete] VERBS.each do |verb| define_method(verb) do |*params| action, request_params = params - request_params ||= {} + + request_params = if request_params.kind_of(Hash) + request_params + else + begin + JSON.parse(request_params) + rescue + {} + end + end + result = super(*params) path = if respond_to?(:example) # Rspec 2 example.metadata[:fdoc] else # Rspec 1.3.2