undefined method `documentations' for RspecApiDocumentation
when running rake docs:generate I get:
rspec_api_documentation-0.9.0/lib/rspec_api_documentation/api_formatter.rb:14
in start' undefined methoddocumentations' for RspecApiDocumentation:Module (NoMethodError)
It definitely should have that method. It's right here.
Could you give me more information about your environment. Perhaps a sample spec you have?
What was the issue?
I'm also having this issue.
RspecApiDocumentation::ApiFormatter
Generating API Docs
No examples found.
/Users/andrewcharleskelley/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec_api_documentation-4.3.0/lib/rspec_api_documentation/api_formatter.rb:16:in start': undefined methoddocumentations' for RspecApiDocumentation:Module (NoMethodError)
Please try to pass option as follows:
--format RspecApiDocumentation::ApiFormatter
I'm also getting this and the --format option seems to be there. Here is my full output. I followed the RSpec Rails starting from scratch example.
/usr/local/Cellar/ruby/2.2.0/bin/ruby -I/usr/local/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib:/usr/local/lib/ruby/gems/2.2.0/gems/rspec-support-3.2.1/lib /usr/local/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/exe/rspec --pattern spec/acceptance//*_spec.rb --format RspecApiDocumentation::ApiFormatter
Generating API Docs
No examples found.
/usr/local/lib/ruby/gems/2.2.0/gems/rspec_api_documentation-4.3.0/lib/rspec_api_documentation/api_formatter.rb:16:in start': undefined methoddocumentations' for RspecApiDocumentation:Module (NoMethodError)
from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/reporter.rb:146:in block in notify' from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/reporter.rb:145:ineach'
from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/reporter.rb:145:in notify' from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/reporter.rb:72:instart'
from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/reporter.rb:60:in report' from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:108:inrun_specs'
from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:86:in run' from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:70:inrun'
from /usr/local/Cellar/ruby/2.2.0/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:38:in invoke' from /usr/local/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.0/exe/rspec:4:in
Ok, I see what my issue was. It is looking for test specs in 'spec/acceptance'. I looked more closely at what the example app was doing and got it to work.
Make sure you have require 'rspec_api_documentation/dsl' at the top of your spec file.
I'm having this problem as well.
$ rake docs:generate /home/aleksandrus/.rvm/rubies/ruby-2.2.3/bin/ruby -I/home/aleksandrus/.rvm/gems/ruby-2.2.3@eadis/gems/rspec-core-3.4.2/lib:/home/aleksandrus/.rvm/gems/ruby-2.2.3@eadis/gems/rspec-support-3.4.1/lib /home/aleksandrus/.rvm/gems/ruby-2.2.3@eadis/gems/rspec-core-3.4.2/exe/rspec --pattern spec/acceptance/**/*_spec.rb --format RspecApiDocumentation::ApiFormatter Generating API Docs No examples found. /home/aleksandrus/.rvm/gems/ruby-2.2.3@eadis/gems/rspec_api_documentation-4.7.0/lib/rspec_api_documentation/api_formatter.rb:16:in
start': undefined methoddocumentations' for RspecApiDocumentation:Module (NoMethodError) from /home/aleksandrus/.rvm/gems/ruby-2.2.3@eadis/gems/rspec-core-3.4.2/lib/rspec/core/reporter.rb:189:in `block in notify'
@dwaynemac @ACPK @ArielAleksandrus ensure ls spec/acceptance/**/*_spec.rb returns something
I forgot to name my files "_spec" and that was my issue
Hi! sorry to comment on a very old issue but I just came across this same issue. The problem for me is that I was building a docker image and running rake docs:generate:ordered as a step in the Dockerfile to generate the documentation inside the container image, BUT I had spec/* in my .dockerignore because normally there'd be no reason to have that directory in my Docker image.
My only thought is that the problem here is pretty clear once you see what's going on: there are no acceptance tests. It'd be nice if the error were clearer.
bundle exec rspec spec --format RspecApiDocumentation::ApiFormatter
I named my spec config file "rspec_api_documentation.rb" and required it. That breaks it. Renaming it to something like "rspec_api_documentation_setup.rb" helped me. EDIT: same problem after long run of all my specs 😳
@davidcpell THANK YOU. I know you posted this literally 2 years ago but you just saved me from such a headache.