Undefined method: controller_name

With rspec 1.0.8 I have a spec in the directory:
spec/units/controllers/application_controller_spec.rb

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

class DummyController < ApplicationController
def index
raise “Prevent index from rendering”
end
end

describe ApplicationController, “Handling errors in production”,
:behaviour_type => :controller do
controller_name :dummy

before(:each) do
# set up request and response
lambda { get :index }.should raise_error
end

it “should display ‘file not found’ when a routing error occurs” do

controller.rescue_action_in_public(ActionController::RoutingError.new(“this
page does not exist”))
response.should render_template(“error/404”)
end
end

and it works.

After updating to rspec revision 3136 and running script/generate rspec,
I get the following error:

kwigger:~/workspace/eTriever-spec-tmp alvin$ script/spec --backtrace
spec/unit/controllers/application_controller_spec2.rb
./spec/unit/controllers/application_controller_spec2.rb:10: undefined
method controller_name' for Spec::Rails::Example::RailsExampleGroup::Subclass_1:Class (NoMethodError) from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:39:inmodule_eval’
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:39:in
describe' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:ininstance_eval’
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in
subclass' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:37:indescribe’
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb:43:in
create_example_group' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/extensions/main.rb:27:indescribe’
from ./spec/unit/controllers/application_controller_spec2.rb:9
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:14:in
load' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:14:inload_files’
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:13:in
each' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb:13:inload_files’
from
/Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/options.rb:83:in
run_examples' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/runner/command_line.rb:19:inrun’
from script/spec:4

Is there a better way to write this spec in 3136?

Thanks,
Alvin.

On Dec 12, 2007 9:50 AM, Alvin S. [email protected] wrote:

describe ApplicationController, “Handling errors in production”,
:behaviour_type => :controller do

Try :type instead and see if that works.

On Dec 12, 2007, at 10:56 AM, David C. wrote:

end

describe ApplicationController, “Handling errors in production”,
:behaviour_type => :controller do

Try :type instead and see if that works.

Yep. I had a bunch of regressions with :behaviour_type => …, which
started to fail a few weeks ago. Changing it to :type seemed to fix
it up.

Scott