rspec_api_documentation icon indicating copy to clipboard operation
rspec_api_documentation copied to clipboard

undefined method `documentations' for RspecApiDocumentation

Open dwaynemac opened this issue 13 years ago • 13 comments

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)

dwaynemac avatar Apr 08 '13 01:04 dwaynemac

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?

oestrich avatar Apr 08 '13 03:04 oestrich

What was the issue?

pavanagrawal avatar Oct 21 '14 17:10 pavanagrawal

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)

ACPK avatar Jan 05 '15 21:01 ACPK

Please try to pass option as follows:

--format RspecApiDocumentation::ApiFormatter

pavanagrawal avatar Jan 07 '15 07:01 pavanagrawal

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

' /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 failed

cpomerantz avatar Feb 09 '15 22:02 cpomerantz

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.

cpomerantz avatar Feb 09 '15 23:02 cpomerantz

Make sure you have require 'rspec_api_documentation/dsl' at the top of your spec file.

rubystar avatar Feb 16 '15 10:02 rubystar

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'

ArielAleksandrus avatar Mar 02 '16 03:03 ArielAleksandrus

@dwaynemac @ACPK @ArielAleksandrus ensure ls spec/acceptance/**/*_spec.rb returns something

I forgot to name my files "_spec" and that was my issue

mpugach avatar Apr 22 '17 07:04 mpugach

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.

davidcpell avatar Dec 10 '19 18:12 davidcpell

bundle exec rspec spec --format RspecApiDocumentation::ApiFormatter

dvik1950 avatar Apr 07 '20 17:04 dvik1950

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 😳

paulslaby avatar Mar 01 '21 17:03 paulslaby

@davidcpell THANK YOU. I know you posted this literally 2 years ago but you just saved me from such a headache.

aimee-ault avatar Dec 07 '21 14:12 aimee-ault