Its very powerful being able to test permissions in the unit tests:
def test_create_permissions
assert @new_league.creatable_by?(users(:an_administrator))
assert @new_league.creatable_by?(users(:a_organizer))
assert ! @new_league.creatable_by?(users(:a_captain))
assert ! @new_league.creatable_by?(users(:a_assistant_captain))
assert ! @new_league.creatable_by?(users(:a_player_1))
assert ! @new_league.creatable_by?(Guest.new)
end
Henry
Dan wrote:
I thought it would be a more realistic simulation of actual behaviour
to set a particular user in the session then use controller tests
(POSTs and GETs) as that user to test permissions. Betelgeuse, can you
give me an example of unit tests directly against the permission
methods please.
On Apr 22, 8:52 pm, Betelgeuse <[email protected]> wrote:
Testing permissions isn't really the job of functional tests.
Permission testing belongs to unit tests. You will then do testing
directly against the permission query methods.
On Apr 21, 5:12 pm, Dan <[email protected]> wrote:
Hi,
I'm writing functional tests for my Hobo controllers. It seems that if
I just post a 'create' request the permissions restrictions are being
ignored. I've set up a basic example in my app to check what was going
on. So I have a class called Widget, which should dissallow all create
requests. See model below:
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group
athttp://groups.google.com/group/hobousers?hl=en.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.