Oi Maurício,
On Jun 7, 2008, at 11:37 AM, Maurício Linhares wrote:
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 )
I would put should_not_receive(:create) in a separate example as it's
a different concept from rendering nothing.
do_xhr
response.should be_success
response.body.strip.should be_empty
You can use the simple_matcher method for this quite ... simply:
def render_nothing
simple_matcher(:nothing) do |response|
response.body.strip == ''
end
end
The failure message on this is quite verbose, and I have an idea about
a solution for that, but it'll work :)
Tchau,
David
On Sat, Jun 7, 2008 at 1:27 PM, Pat Maddox <[EMAIL PROTECTED]> 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
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users