Fix doc generators
parent
860d6825fc
commit
6cf6a4434e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue