I wanted to use "integrate_views" as Ryan explains in his RailsCast #71 (http://railscasts.com/episodes/71) ...but I can''t get it to work: the view code in not executed I looked everywhere but I can''t understand what I am doing wrong. Here is what I did: I created a new application from scratch (Rails 2.0.2), added rspec and rspec_on_rails plugins, and run script/generate rspec_scaffold User name:string This is my users_controller spec: describe UsersController do fixtures :users integrate_views describe "handling GET /users" do it "should be successful" do get :index response.should be_success end end end I then added something wrong (on purpose) in index.html.erb (<% WRONG %>) so that when I visit /users I get a view error (undefined local variable or method....) But when I run the spec everything is ok and the test does NOT fail :-( I can even trash the index.html.erb file and the test still passes -- Posted via http://www.ruby-forum.com/.
David Chelimsky
2008-Jan-23 07:34 UTC
[rspec-users] integrate_views is not executing my views
On Jan 23, 2008 1:17 AM, Ze No <lists at ruby-forum.com> wrote:> I wanted to use "integrate_views" as Ryan explains in his RailsCast #71 > (http://railscasts.com/episodes/71) > > ...but I can''t get it to work: the view code in not executed > > I looked everywhere but I can''t understand what I am doing wrong. > Here is what I did: > I created a new application from scratch (Rails 2.0.2), added rspec and > rspec_on_rails plugins, and run > script/generate rspec_scaffold User name:string > > This is my users_controller spec: > > describe UsersController do > fixtures :users > integrate_views > > describe "handling GET /users" do > it "should be successful" do > get :index > response.should be_success > end > end > endTry it without nesting: describe UsersController, "handling GET /users" do fixtures :users integrate_views it "should be successful" do get :index response.should be_success end end If that works, then you''ve uncovered a bug with integrate_views not working in nested example groups. If so, please report it to the tracker: http://rspec.lighthouseapp.com Thanks, David> > I then added something wrong (on purpose) in index.html.erb (<% WRONG > %>) so that when I visit /users I get a view error (undefined local > variable or method....) > > But when I run the spec everything is ok and the test does NOT fail :-( > I can even trash the index.html.erb file and the test still passes > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
You are God. Thanks! You can''t imagine the amount of time we wasted on that one ;-)> If that works, then you''ve uncovered a bug with integrate_views not > working in nested example groups.that was exactly the problem.> If so, please report it to the trackerdefinitely -- Posted via http://www.ruby-forum.com/.