On Sat, Jun 27, 2009 at 10:14 AM, mBread<mbr...@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
>     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

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
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to