add 'to' action to controller, add test (currently failing, show error)
Matt S Trout [Sat, 7 Mar 2009 20:26:16 +0000 (15:26 -0500)]
lib/LolCatalyst/Lite/Controller/Translate.pm
t/controller_Translate.t

index 04d6a96..749b3ac 100644 (file)
@@ -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;
index 1733716..59c2ca4 100644 (file)
@@ -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");