I wanted to use “integrate_views” as Ryan explains in his RailsCast #71
(#71 Testing Controllers with RSpec - RailsCasts)
…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