Skip to content

Instantly share code, notes, and snippets.

@s1037989
Last active August 29, 2015 14:15
Show Gist options
  • Save s1037989/4ef7bbfc21bacc10d934 to your computer and use it in GitHub Desktop.
Save s1037989/4ef7bbfc21bacc10d934 to your computer and use it in GitHub Desktop.
Problem with static files in Mounted apps
t/mojolicious/embedded_lite_app.t .......... 3/?
# Failed test 'exact match for content'
# at t/mojolicious/embedded_lite_app.t line 186.
Wide character in print at /usr/share/perl/5.18/Test/Builder.pm line 1759.
# got: 'myapp
# works ♥!Insecure!Insecure!
#
# too!works!!!Mojolicious::Plugin::Config::Sandbox
# <a href="/">Test</a>
# <form action="/%E2%98%83">
# <input type="submit" value="☃">
# </form>
# Static Version: /index.html
# '
# expected: 'myapp
# works ♥!Insecure!Insecure!
#
# too!works!!!Mojolicious::Plugin::Config::Sandbox
# <a href="/x/1/">Test</a>
# <form action="/x/1/%E2%98%83">
# <input type="submit" value="☃">
# </form>
# Static Version: /x/1/index.html
# '
# Looks like you failed 1 test of 181.
t/mojolicious/embedded_lite_app.t .......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/181 subtests
diff --git a/t/mojolicious/embedded_lite_app.t b/t/mojolicious/embedded_lite_app.t
index 883635a..169bffc 100644
--- a/t/mojolicious/embedded_lite_app.t
+++ b/t/mojolicious/embedded_lite_app.t
@@ -179,6 +179,20 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/x/1/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /x/1/index.html
+EOF
+
+# Template from myapp.pl
+$t->get_ok('/x/1')->status_is(200)->content_is(<<'EOF');
+myapp
+works ♥!Insecure!Insecure!
+
+too!works!!!Mojolicious::Plugin::Config::Sandbox
+<a href="/x/1/">Test</a>
+<form action="/x/1/%E2%98%83">
+ <input type="submit" value="☃">
+</form>
+Static Version: /x/1/index.html
EOF
# Static file from myapp.pl
@@ -212,6 +226,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/x/%E2%99%A5/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /x/%E2%99%A5/index.html
EOF
# Static file from myapp.pl with Unicode prefix
@@ -280,6 +295,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /index.html
EOF
# Host from myapp.pl with domain
@@ -297,6 +313,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /index.html
EOF
# Host from myapp.pl with domain again
@@ -314,6 +331,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /index.html
EOF
# Host from myapp.pl with wildcard domain
@@ -339,6 +357,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/%E2%99%A5/123/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /%E2%99%A5/123/index.html
EOF
# Host from myapp.pl with wildcard domain and Unicode prefix
diff --git a/t/mojolicious/external/templates/index.html.ep b/t/mojolicious/external/templates/index.html.ep
index 62bfae2..bbd6b2a 100644
--- a/t/mojolicious/external/templates/index.html.ep
+++ b/t/mojolicious/external/templates/index.html.ep
@@ -4,3 +4,4 @@
%= form_for '/☃' => begin
%= submit_button '☃'
%= end
+Static Version: <%= url_for '/index.html' %>
diff --git a/t/mojolicious/external_lite_app.t b/t/mojolicious/external_lite_app.t
index 49a5c1d..a33ff5a 100644
--- a/t/mojolicious/external_lite_app.t
+++ b/t/mojolicious/external_lite_app.t
@@ -24,6 +24,7 @@ too!works!!!Mojolicious::Plugin::Config::Sandbox
<form action="/%E2%98%83">
<input type="submit" value="☃">
</form>
+Static Version: /index.html
EOF
# Static file from myapp.pl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment