Re: [rspec-users] Mocking Access Control

2007-07-27 Thread Justin Williams
ll for the whole action. > > def has_role?(name) > @role_names ||= roles.map(&:name) > @role_names.include?(name) > end > > So you can change the implementation without screwing round with a > bunch of tests. In fact neither of these would require a change of

Re: [rspec-users] Mocking Access Control

2007-07-26 Thread Justin Williams
no redirect". If I modify the test to be should render_template("index") it will fail, saying that the template is reverting back to login. Any ideas on what I'm doing wrong? Thanks! - j On 7/24/07, Justin Williams <[EMAIL PROTECTED]> wrote: > On 7/24/07, David C

Re: [rspec-users] Mocking Access Control

2007-07-24 Thread Justin Williams
On 7/24/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > Would you please post the code for the actions as well? def login if request.post? begin session[:user] = User.authenticate(params[:login][:email], params[:login][:password]).id if current_user.roles.include?(Role.find_by_title

[rspec-users] Mocking Access Control

2007-07-24 Thread Justin Williams
;expected redirect to {:action=>"index", :controller=>"toolkit/overview"}, got no redirect" I am pretty sure it is because I haven't set the role attribute, but I'm not sure how to establish that relationship using stubs. I tried setting mock_model(User, :r