[Catalyst] Semi-OT testing question

Jesse Sheidlower jester at panix.com
Fri Jun 10 15:10:39 GMT 2011


I'm testing a Cat app using T::W::M::Catalyst, and am struggling to
understand why one test is failing. It's only the test that's failing;
the action is OK.

I have a simple add-user form that has several checkboxes for different
roles the user can have. I first tick the checkbox corresponding to the
role I want, and then use submit_form_ok with the rest of the info. (If
I can tick the box using submit_form_ok I'm happy to do so, but I can't
figure out how.)

---

ok( $mech_admin->tick('roles','2'), "ticked the newwords_admin checkbox" );

$mech_admin->submit_form_ok( { fields => {
  login => 'new_user',
  password => 'new_user',
  name => 'New Regular User',
  email => 'FOO-new at bar.com'
}, }, "Submitted add-user form");

---

The only thing failing here is the _test_ in the first line of this. The
form is submitted correctly, and when I test the "view" page for this
newly-created user, it has the correct role.

Similarly, for my "edit" test, I untick this role, tick a different
role, and the results are correct. But both "ok" tests for the unticking
and ticking, fail.

What's wrong with my test here?

Thanks.

Jesse Sheidlower



More information about the Catalyst mailing list