[Jifty-commit] jifty branch, master, updated. 76a1f6b6027ade405945a05441ca51f1cb3879d4

Jifty commits jifty-commit at lists.jifty.org
Thu Apr 1 14:31:30 EDT 2010


The branch, master has been updated
       via  76a1f6b6027ade405945a05441ca51f1cb3879d4 (commit)
      from  1c73572c7d4526c18da53d94e357804502b4d02d (commit)

Summary of changes:
 .../lib/TestApp/Uploads/Action/Backcompat.pm       |   25 ++++++++++++++++++++
 t/TestApp-Uploads/t/{rest.t => back-compat.t}      |   10 ++-----
 2 files changed, 28 insertions(+), 7 deletions(-)
 create mode 100644 t/TestApp-Uploads/lib/TestApp/Uploads/Action/Backcompat.pm
 copy t/TestApp-Uploads/t/{rest.t => back-compat.t} (70%)

- Log -----------------------------------------------------------------
commit 76a1f6b6027ade405945a05441ca51f1cb3879d4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Apr 1 14:30:16 2010 -0400

    Add (passing) test for upload back-compat

diff --git a/t/TestApp-Uploads/lib/TestApp/Uploads/Action/Backcompat.pm b/t/TestApp-Uploads/lib/TestApp/Uploads/Action/Backcompat.pm
new file mode 100644
index 0000000..716c120
--- /dev/null
+++ b/t/TestApp-Uploads/lib/TestApp/Uploads/Action/Backcompat.pm
@@ -0,0 +1,25 @@
+package TestApp::Uploads::Action::Backcompat;
+use strict;
+use warnings;
+
+use Jifty::Param::Schema;
+use Jifty::Action schema {
+    param 'upload_file' =>
+        label is 'Upload file',
+        render as 'Upload';
+};
+
+sub take_action {
+    my $self = shift;
+    my $filehandle = $self->argument_value('upload_file');
+
+    my $first_line = <$filehandle>;
+    chomp $first_line;
+
+    $self->result->content(first_line => $first_line);
+
+    return 1;
+}
+
+1;
+
diff --git a/t/TestApp-Uploads/t/back-compat.t b/t/TestApp-Uploads/t/back-compat.t
new file mode 100644
index 0000000..6344b79
--- /dev/null
+++ b/t/TestApp-Uploads/t/back-compat.t
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use Jifty::Test::Dist tests => 5;
+use Jifty::Test::WWW::Mechanize;
+use HTTP::Request::Common;
+
+my $server  = Jifty::Test->make_server;
+isa_ok($server, 'Jifty::TestServer');
+my $URL     = $server->started_ok;
+my $mech    = Jifty::Test::WWW::Mechanize->new;
+
+ok(1, "Loaded the test script");
+
+# we can't use $0 because Jifty::Test::Dist can chdir and
+# $0 doesn't track that
+$mech->request(POST "$URL/=/action/Backcompat.yml",
+    Content_Type => 'multipart/form-data',
+    Content => [
+        upload_file => ['t/upload.txt'],
+    ],
+);
+my $results = Jifty::YAML::Load($mech->content);
+ok($results->{success}, 'success');
+is_deeply($results->{content}, {
+    first_line => "hlagh",
+});
+

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list