[rspec-users] Match render :nothing

Maurício Linhares mauricio.linhares at gmail.com
Sat Jun 7 12:37:10 EDT 2008

Hi Pat,

'response.body.should be_empty" does not work :(

The string on the response after a "render :nothing" is " " (one space
character), so i had to do a strip to make it work. I guess i'll write
my own render_nothing matcher anyway. Here's how it is now:

      @assignments.should_receive( :find ).and_return( [ @assignment ] )
      @assignments.should_not_receive( :create )
      response.should be_success
      response.body.strip.should be_empty

On Sat, Jun 7, 2008 at 1:27 PM, Pat Maddox <pergesu at gmail.com> wrote:
> I'm pretty sure you can do
> response.body.should be_blank # or == ""
> If you don't like how it reads, you could create a custom
> render_nothing matcher.
> Pat

Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

More information about the rspec-users mailing list