Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec 2 on Rails 3 - access_control_spec.rb issues #10

Open
sshreibati opened this issue Jan 29, 2011 · 1 comment
Open

rspec 2 on Rails 3 - access_control_spec.rb issues #10

sshreibati opened this issue Jan 29, 2011 · 1 comment

Comments

@sshreibati
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant