I’ve got this test:
describe LoginController do
describe “GET index” do
it “should be successful” do
get ‘index’
response.should be_success
end
end
end
which passes, but a cucumber test fails on trying to get the index for
LoginController, with the message:
No action responded to index. Actions:
This error happens in cucumber & on a manual test (with a 404 status in
the
headers) because the LoginController is empty & there is no index view
for
it, but I want a failing rspec test before I correct it, but it insists
that
it’s getting a 200 status.
Any ideas? Thanks
On Sat, Jun 27, 2009 at 10:14 AM, mBread[email protected] wrote:
Any ideas? Thanks
That is by design. RSpec is about spec’ing things in isolation,
whereas cucumber is about spec’ing things end to end. RSpec controller
specs are about controllers, not views, so the presence and/or
validity of a view should not impact the controller spec.
If you want to use controller specs to fail when your views are
missing, you can use the integrate_views directive:
describe LoginController do
describe “GET index” do
integrate_views
it “should be successful” do
get ‘index’
response.should be_success
end
end
end
That is available, but is not the rspec way.
HTH,
David
David C.-2 wrote:
That is by design. RSpec is about spec’ing things in isolation,
whereas cucumber is about spec’ing things end to end. RSpec controller
specs are about controllers, not views, so the presence and/or
validity of a view should not impact the controller spec.
It was the ‘no action responded to…’ error, which I believe is to do
with
methods existing in the controller, not the ‘template is missing’ error
regarding a missing view (I wasn’t aware of the second one when I made
the
first post). I didn’t realise that error would disappear when a view
exists
but no methods, so I see now that it is an integration issue, not a unit
issue. Thanks
View this message in context:
http://www.nabble.com/RSpec-not-failing-when-requesting-missing-method-view-tp24233965p24234411.html
Sent from the rspec-users mailing list archive at Nabble.com.