restful-authentication icon indicating copy to clipboard operation
restful-authentication copied to clipboard

rspec 2 on Rails 3 - access_control_spec.rb issues

Open sshreibati opened this issue 14 years ago • 1 comments

I've had testing the rspec because I'm on rspec 2 I assume. Here are some of my issues:

1.) "include AuthenticatedSystem" needs to be included 2.) in the "before" statement where they add routes the old way was "ActionController::Routing::Routes.add_route /login_is_required', :controller => 'access_control_test', :action => 'login_is_required'"

INSTEAD USE begin _routes = Savingsgame::Application.routes _routes.disable_clear_and_finalize = true _routes.clear! Savingsgame::Application.routes_reloader.paths.each{ |path| load(path) } _routes.draw do # here you can add any route you want get "/login_not_required", :to => "access_control_test#login_not_required" get "/login_is_required", :to => "access_control_test#login_is_required" end ActiveSupport.on_load(:action_controller) { _routes.finalize! } ensure _routes.disable_clear_and_finalize = false end 3.) Because I'm using rspec 2, I need to change all the route_for, params_for and has_text, but those are easy, just look up the https://github.com/rspec/rspec-rails

sshreibati avatar Jan 29 '11 21:01 sshreibati

Oh, you probably want to add the following in the spec_helper.rb instead of each spec. include AuthenticatedTestHelper include AuthenticatedSystem

sshreibati avatar Jan 29 '11 21:01 sshreibati