RSpec 2: undefined method `controller_name' for :Class (NoMethodError)

describe ApplicationController, “handling AccessDenied exceptions” do

class FooController < ApplicationController
def index
raise AccessDenied
end
end
controller_name ‘foo’ # OUCH!!!

it “redirects to the /401.html (access denied) page” do
get :index
response.should redirect_to(’/401.html’)
end

end

So how do I set the controller name using RSpec 2/Rails 3?

Have you figured that out?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs