Fix doc generators

pull/337/head
Rick Carlino 2017-07-06 01:30:31 -05:00
parent 860d6825fc
commit 6cf6a4434e
2 changed files with 8 additions and 14 deletions

View File

@ -5,16 +5,6 @@ describe Api::PeripheralsController do
describe '#create' do
let(:user) { FactoryGirl.create(:user) }
it 'Ignores ridiculously long names' do
pending "See stackoverflow question below:"
# https://stackoverflow.com/questions/44890107
# /length-is-not-enforced-on-string-column-with-postgresql
sign_in user
Peripheral.destroy_all
before = Peripheral.count
post :create, params: { pin: 13, mode: 0, label: ("@"*700) }
expect(response.status).to eq(422)
end
it 'makes a Peripheral' do
sign_in user

View File

@ -70,7 +70,10 @@ class NiceResponse
end
def has_params?
r.params.except(:controller, :action, :format, :id).keys.length > 0
r.params
.except(:controller, :action, :format, :id)
.keys
.length > 0
end
def has_body?
@ -79,11 +82,13 @@ class NiceResponse
def display_body
begin
JSON.parse(body)
JSON
.pretty_generate(JSON.parse(body))
.first(500)
rescue
JSON.pretty_generate(r
.params
.except(:controller, :action, :format, :id, :user_id, :device_id))
.except(:controller, :action, :format, :id, :user_id, :device_id)).first(500)
end
end
@ -93,6 +98,5 @@ class NiceResponse
else
""
end
end
end