From: Matt S Trout Date: Sat, 7 Mar 2009 20:26:16 +0000 (-0500) Subject: add 'to' action to controller, add test (currently failing, show error) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2Fcatbook-code.git;a=commitdiff_plain;h=9671ec672cfd44e4421fdf72f8179c2e8f5d8cab add 'to' action to controller, add test (currently failing, show error) --- diff --git a/lib/LolCatalyst/Lite/Controller/Translate.pm b/lib/LolCatalyst/Lite/Controller/Translate.pm index 04d6a96..749b3ac 100644 --- a/lib/LolCatalyst/Lite/Controller/Translate.pm +++ b/lib/LolCatalyst/Lite/Controller/Translate.pm @@ -34,4 +34,13 @@ sub view :Chained('object') :PathPart('') :Args(0) { ); } +sub translate_to :Chained('object') :PathPart('to') :Args(1) { + my ($self, $c, $to) = @_; + my $object = $c->stash->{object}; + $c->stash( + result => $object->translated_to($to) + ); + $c->stash(template => 'translate/view.tt'); +} + 1; diff --git a/t/controller_Translate.t b/t/controller_Translate.t index 1733716..59c2ca4 100644 --- a/t/controller_Translate.t +++ b/t/controller_Translate.t @@ -20,3 +20,11 @@ ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); like( $response->content, qr/CHEEZ/, "contains translated string"); +ok( + $response = request(GET 'http://localhost/translate/1/to/LOLCAT'), + 'Request for specific translation type' +); + +ok( $response->is_success, 'Response Successful 2xx' ); + +like( $response->content, qr/CHEEZ/, "contains translated string");