Rspec Test render(:nothing = true)

I was trying to test one of my controllers was successfully hitting the render(:nothing = true) block. I could not find anything specifically in the API which handled this senario, so I ended up using have_text with a space as an argument.

@response.should have_text(" ")

Posted on March 31, 2008 at 4:15 pm by doug · Permalink
In: Uncategorized · Tagged with: 

2 Responses

Subscribe to comments via RSS

  1. Written by John
    on August 4, 2010 at 4:05 am
    Permalink

    This might be equivalent/cleaner/better:

    response.body.should be_empty

  2. Written by Rodrigo Flores
    on August 22, 2010 at 9:49 pm
    Permalink

    John

    It does not return a empty string, but a string with only one space (” “).

    The equivalent/cleaner/better is:

    response.body.should be_blank

Subscribe to comments via RSS

Leave a Reply