Rspec controller not working, but works for models

I’m new with rspec and using rails 1.2.3, and plugins
(rspec/rspec_on_rails 1.0.5). Followed tutorials by lukeredpath and
rspec’s writing tutorial at their site.

I have an agencies controller, thus creating spec files for this
controller:-

spec/controllers/agencies_controller_spec.rb

require File.dirname(FILE) + ‘/…/spec_helper’
describe AgenciesController do

#Delete this example and add some real ones
it “should use AgenciesController” do
controller.should be_an_instance_of(AgenciesController)
end

end

describe AgenciesController, “#route_for” do

it “should map { :controller => ‘agencies’, :action => ‘index’ } to
/agencies” do
route_for(:controller => “agencies”, :action => “index”).should ==
“/agencies”
end

end

when I run it - ruby script/spec
spec/controllers/agencies_controller_spec.rb I get these errors


NameError in ‘AgenciesController should use AgenciesController’
undefined local variable or method controller' for [Dynamically generated class for RSpec example]:#<Class:0x464f088> ./spec\controllers\agencies_controller_spec.rb:7: script/spec_server:23:inrun’
script/spec_server:44:

NoMethodError in ‘AgenciesController#route_for should map { :controller
=> ‘agen
cies’, :action => ‘index’ } to /agencies’
undefined method route_for' for [Dynamically generated class for RSpec example] :#<Class:0x46426bc> ./spec\controllers\agencies_controller_spec.rb:15: script/spec_server:23:inrun’
script/spec_server:44:

Finished in 0.016 seconds

2 examples, 2 failures


anyone know what went wrong? since I can run my model specs, and it
seems that route_for is native to rspec