richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoMethodError: undefined method `<' for false:FalseClass

heaven opened this issue · comments

/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:140:in `process_path'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:75:in `block in generate_doc'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:74:in `each'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:74:in `generate_doc'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:56:in `block in generate_docs'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:53:in `each'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:53:in `generate_docs'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/swagger/docs/generator.rb:24:in `write_docs'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/gems/swagger-docs-0.2.6/lib/tasks/swagger.rake:5:in `block (2 levels) in <top (required)>'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/bin/ruby_executable_hooks:15:in `eval'
/Users/heaven/.rvm/gems/ruby-2.2.1@clarion/bin/ruby_executable_hooks:15:in `<main>'

There's a typo in the code, at the line https://github.com/richhollis/swagger-docs/blob/master/lib/swagger/docs/generator.rb#L139

This:

if config[:parent_controller] && !klass < config[:parent_controller]

Should probably be:

if config[:parent_controller] && !(klass < config[:parent_controller])

Ah yes - good spot. This came in on a recent PR and there wasn't any coverage for it. Thanks for the solution. This has been added with a basic spec to cover it.