diff --git a/api_docs.md.erb b/api_docs.md.erb index 24d82237e..34cb5d928 100644 --- a/api_docs.md.erb +++ b/api_docs.md.erb @@ -1,15 +1,15 @@ <% if (response.success? || note.present?) %> -# <%= response.success? ? "" : "(NOT OK)" %> <%= request.method %> <%= request.path.first(45) %> +# <%= response.success? ? "" : "(NOT OK)" %> <%= request.pretty_url %> <% if note.present? %> **Notes:** <%= note %> <% end %> -<% if request.params.except(:controller, :action, :format, :id).keys.length > 0 %> +<% if request.has_params? %> ### Request ``` <%= - JSON.pretty_generate(request.params.except(:controller, :action, :format, :id, :user_id, :device_id)) + request.display_body %> ``` <% end %> diff --git a/db/migrate/20170629160248_change_default_radius.rb b/db/migrate/20170629160248_change_default_radius.rb new file mode 100644 index 000000000..8c6788f8b --- /dev/null +++ b/db/migrate/20170629160248_change_default_radius.rb @@ -0,0 +1,5 @@ +class ChangeDefaultRadius < ActiveRecord::Migration[5.1] + def change + change_column :points, :radius, :float, default: 25 + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d550ac54a..6e7d4b194 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -37,7 +37,7 @@ RSpec.configure do |config| if ENV['DOCS'] config.after(:each, type: :controller) do - SmarfDoc.run!(request, response) + SmarfDoc.run!(NiceResponse.new(request), response) end config.after(:suite) do @@ -52,3 +52,30 @@ def const_reassign(target, const, value) target.send(:remove_const, const) target.const_set(const, value) end + +class NiceResponse + attr_reader :r + + def initialize(r) + @r = r + end + + def path + r.path + end + + def pretty_url + r.method + " " + r.path.first(45) + end + + def has_params? + r.params.except(:controller, :action, :format, :id).keys.length > 0 + end + + def display_body + p = r + .params + .except(:controller, :action, :format, :id, :user_id, :device_id) + JSON.pretty_generate(p) + end +end