[rspec-users] rspec doesnt recognize a custom mime type

jollyroger timo.roessner at googlemail.com
Thu Apr 29 08:40:48 EDT 2010


fixed it, in a nutshell:

Doesnt work:

get :new, :format => :lightbox


get :new, :format => 'lightbox'

What was really confusing was that in BOTH cases the same URL appeared
in the log.

Here is my turn on what happened:

Internally - when rails sees a mime-type / format - rails
distinguishes between a string and a symbol, saying that when using
something like

respond_to do |format|
  format.lightbox {}

"lightbox" is expected to be a string.

When doing a normal request via a browser I passed in the format in
the URL, so as a string.
When running a spec apparently this is passed directly the way I wrote
it, so as a symbol.

That's why one and the same URL worked in the browser, but not in my

Does this sound plausible?

More information about the rspec-users mailing list