Hi Jarkko, I see your point.

However, checking the user's roles in order to authorize access to the 
action is done behind the scenes by the acl_system2 plugin, which would 
not know what to do with has_role?, unless I am missing something.

Thanks!
Giuseppe

> You might want to take that one step further and create a method such
> as has_role?(:operator) for the user class. That way you don't have to
> stub arrays  like roles in your specs, you just stub that method to
> return true or false and you're done. That way you make your code more
> easily "speccable":
> 
> def has_role?(role)
>    roles.map(&:title).include?(role.to_s)
> end
> 
> //jarkko
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to