The following RSpec 2 test..
describe "GET new" do
describe "gets a report form" do
xhr :get, :new, :post_id => @post
response.should be_success
end
end
gives this nice error:
undefined method xhr for #<Class:0xb5c72404> (NoMethodError)
Any idea what is wrong?
It turns out you have to use an it
statement in the describe
block. Then the error goes away. If you do not use the right amount of describe
and it
blocks, then RSpec produces all kinds of weird errors. This is the correct code:
describe "GET new" do
it "gets a report form" do
xhr :get, :new, :post_id => @post
response.should be_success
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With