module AutoRswag

This module hooks into the Rspec test to retrieve useful metadata and submit it to AutoRswagHelper for conversion.

Public Instance Methods

update_documentation() click to toggle source
# File lib/auto_rswag.rb, line 11
def update_documentation
  after do |example|
    title = example.metadata[:response][:schema]['$ref'].split('/').last
    payload = AutoRswagHelper.convert_response(response)
    AutoRswagHelper.map_fields(payload)
    docs = SwaggerPrinter.print_swagger(payload, title)
    DocWriter.new.write_docs(docs, title)
  end
end