ChatGPT解决这个技术问题 Extra ChatGPT

RSpec documentation...where is it hiding?

Having a terrible time finding RSpec-2 (and rspec-rails) documentation. Specifically I want to look up all available Matchers... but how?

I've tried:

RSpec.info : outdated - RSpec 1.x

rdoc.info : seems useless, to me anyway. (incomplete?)

RSpec-Relish : confusing. incomplete? how would one look up available Matchers?

GitHub Wiki : scattered info. unorganized. incomplete?

Yes, I'm aware of The Book...but, seriously, isn't this stuff online?

Even tried rake doc:plugins but it didn't work. Too green to know why...

apparently there used to be some decent 1.x docs on rspec.rubyforge.org. but they're appear to be long gone...

Where are these docs hiding?

+1 for cool question title
As of Dec 27 2013, 2.14.3 is the latest. rdoc.info/gems/rspec-expectations/2.14.3/frames. You can find Built-in matchers.

G
Gavin Miller

The first place to go is the official Relish docs, they have gotten a significant improvement over the years and are now my first place to look.

At the time of writing this answer originally, this gist was solid. It contains matchers for the following:

Capybara

Paperclip with Shoulda

Rspec Rails

Rspec Exceptions

Shoulda Matchers


This, to me, is a great answer.
K
Keith Gaddis

Not sure why you feel rdoc.info isn't useful - here's the matcher docs there:

http://rubydoc.info/gems/rspec-expectations/2.0.1/RSpec/Matchers

It may be that you're looking in the wrong spot; these were in the RSpec::Expectations gem, which is split out from the core in Rspec 2.


Thanks! That's helpful! I must be using rdoc.info site wrong as I search for "rspec" and get: http://rdoc.info/gems/rspec/2.2.0/frames. then try to search for matcher and get nothing. and if I browse I get lost/confused in multiple embedded frames.
OK, please bear with me... I'm trying to learn Ruby/Rails and finding it incredibly difficult to look things up that I find in code... for example: using the rubydoc.info site I've tried searching for mock_model and came up empty...again. Same thing with as_null_object. This is the most confusing documentation I've ever come across... Sure I could Google, and I have been, but that's a shotgun approach. How should I be approaching the "problem" of looking up and understanding some method/symbol, etc. that I come across in Ruby/Rails/RSpec/JQuery code?
What I do is create a package at Railsapi.com, download it, and unzip it to my local hard drive. Then I create a fluid single-site-browser (I'm on mac, use prism on linux or windows) pointed at the index file from the package. railsapi.com's docs have a pretty good search index built into them, so I usually start there. If i can't find what I need in that, then I'll hit up rdoc.info with some educated guesses about where the docs ought to be. Google is my last resort.
for example, typing "mock_model" into my railsapi.com docs browser points to one result, Spec::Rails::Mocks. "as_null_object" gives me two results, one in Spec::Mocks::Methods and one in Spec::Mocks::Proxy. Neither has much in the way of documentation, but both can show the source of the method in question, and both have links to github as well.
Excellent! On a Mac as well... I'll look into railsapi.com. Thank you for your help!