Reputation: 28245
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?
Upvotes: 8
Views: 3471
Reputation: 28245
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
Upvotes: 16