[rspec-users] RSpec not failing when requesting missing method/view
dchelimsky at gmail.com
Sat Jun 27 11:21:15 EDT 2009
On Sat, Jun 27, 2009 at 10:14 AM, mBread<mbread at m-bread.com> wrote:
> I've got this test:
> describe LoginController do
> describe "GET index" do
> it "should be successful" do
> get 'index'
> response.should be_success
> 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
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
it "should be successful" do
That is available, but is not the rspec way.
More information about the rspec-users