PerlDancer/Dancer2 — pull request #106 by mokko (2012-10-20 18:39:36+00:00)
Title: Fixed types tests

On icq, mst encouraged me to write emails to you guys (Sawyer, Mattp-, Yanik). But instead of filling up your mailboxes, let me try once again in the issue queue. In retrospect, the last time I wasn't very clear about what I was doing. So I will be a little more clear this time.

Sawyer created branch fixed-types-tests 7 days ago. In my opinion this branch incorporates the most recent changes to fix the recently introduced problems due to MooX::Types::MooseLike.

1st error: Layout
----------------------

After `make test` the first error I get looks like this:
```
t/00-compile.t ............ 39/49 isa check for "layout" failed: undef is not a string! at (eval 91) line 126.
```
Elsewhere, I suggested (https://github.com/PerlDancer/Dancer2/pull/97)

to change layout in lib/Dancer/Core/Role/Template.pm to Maybe[Str]. which restores old behavior (prior to MooX::Types::MooselLike 0.16), fixes layout test failure above.

According to my understanding, that is what Saywer suggests in discussing https://github.com/PerlDancer/Dancer2/pull/91

If I apply that the next error I get during testing is:

*2nd error
--------------

```
t/ajax_plugin.t ........... isa check for "prefix" failed: undef is not a DancerPrefix! at (eval 167) line 116.
```

I believe this issue has not been discussed in any of the recent PRs and the issue queue.

In my naivete, i suggest the same remedy: restoring previous functionality.

change attribute 'prefix' in lib/Dancer/Core/App.pm and in lib/Dancer/Core/Route.pm to
Maybe[DancerPrefix]

That fixes the tests. Next error.

*3rd error
-------------

```
t/cookie.t ................ 1/? isa check for "path" failed: undef is not a string! at (eval 19) line 108.
Dancer::Core::Cookie::new('Dancer::Core::Cookie', 'value', 'foo', 'name', 'bar', 'path', undef) called at t/cookie.t line 125
# Tests were run but no plan was declared and done_testing() was not seen.
```

This was discussed by Sawyer and Yanik, see https://github.com/PerlDancer/Dancer2/pull/99

Suggested remedy is what in my understanding Sawyer suggested there
no default, read-only object.

Anyways, that fixes the test failure.

(same remedy as already suggested in https://github.com/PerlDancer/Dancer2/pull/102)

Note: read-only for cookie path as requested in pull 102 means we have to rewrite some tests in t/cookie.t .

read-only means we have to construct a new object to set path. Is that really what you want?

PS
----
I tried really hard to come up with meaningful commit messages.