rjspotter-ramaze 2009.06.29
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.mailmap +25 -0
- data/MANIFEST +502 -0
- data/README.md +457 -0
- data/Rakefile +88 -0
- data/benchmark/bench_templates/bench.rb +67 -0
- data/benchmark/bench_templates/view/large.erb +79 -0
- data/benchmark/bench_templates/view/large.haml +41 -0
- data/benchmark/bench_templates/view/large.xhtml +79 -0
- data/benchmark/bench_templates/view/small.erb +21 -0
- data/benchmark/bench_templates/view/small.haml +12 -0
- data/benchmark/bench_templates/view/small.xhtml +21 -0
- data/benchmark/results.txt +131 -0
- data/benchmark/run.rb +355 -0
- data/benchmark/suite/minimal.rb +11 -0
- data/benchmark/suite/no_informer.rb +7 -0
- data/benchmark/suite/no_sessions.rb +9 -0
- data/benchmark/suite/no_template.rb +7 -0
- data/benchmark/suite/simple.rb +5 -0
- data/benchmark/suite/template_erubis.rb +8 -0
- data/benchmark/suite/template_etanni.rb +8 -0
- data/benchmark/suite/template_ezamar.rb +8 -0
- data/benchmark/suite/template_haml.rb +13 -0
- data/benchmark/suite/template_liquid.rb +11 -0
- data/benchmark/suite/template_markaby.rb +9 -0
- data/benchmark/suite/template_nagoro.rb +8 -0
- data/benchmark/suite/template_redcloth.rb +13 -0
- data/benchmark/suite/template_tenjin.rb +8 -0
- data/benchmark/test.rb +35 -0
- data/bin/ramaze +15 -0
- data/doc/AUTHORS +44 -0
- data/doc/CHANGELOG +17362 -0
- data/doc/COPYING +56 -0
- data/doc/FAQ +92 -0
- data/doc/GPL +339 -0
- data/doc/INSTALL +92 -0
- data/doc/LEGAL +26 -0
- data/doc/TODO +29 -0
- data/doc/meta/announcement.txt +146 -0
- data/doc/meta/configuration.txt +163 -0
- data/doc/meta/internals.txt +278 -0
- data/doc/meta/users.kml +64 -0
- data/doc/tutorial/todolist.html +1379 -0
- data/doc/tutorial/todolist.txt +920 -0
- data/examples/app/auth/layout/auth.xhtml +25 -0
- data/examples/app/auth/start.rb +23 -0
- data/examples/app/auth/view/index.xhtml +4 -0
- data/examples/app/auth/view/login.xhtml +20 -0
- data/examples/app/auth/view/secret.xhtml +1 -0
- data/examples/app/blog/README +3 -0
- data/examples/app/blog/app.rb +69 -0
- data/examples/app/blog/config.ru +17 -0
- data/examples/app/blog/controller/comment.rb +45 -0
- data/examples/app/blog/controller/entry.rb +85 -0
- data/examples/app/blog/controller/init.rb +86 -0
- data/examples/app/blog/controller/main.rb +20 -0
- data/examples/app/blog/controller/tag.rb +9 -0
- data/examples/app/blog/layout/default.nag +31 -0
- data/examples/app/blog/model/comment.rb +58 -0
- data/examples/app/blog/model/entry.rb +89 -0
- data/examples/app/blog/model/init.rb +15 -0
- data/examples/app/blog/model/tag.rb +36 -0
- data/examples/app/blog/public/css/screen.css +273 -0
- data/examples/app/blog/spec/blog.rb +87 -0
- data/examples/app/blog/start.rb +5 -0
- data/examples/app/blog/view/comment/form.nag +10 -0
- data/examples/app/blog/view/comment/show.nag +16 -0
- data/examples/app/blog/view/entry/edit.nag +14 -0
- data/examples/app/blog/view/entry/feed.atom.nag +8 -0
- data/examples/app/blog/view/entry/feed.rss.nag +7 -0
- data/examples/app/blog/view/entry/index.nag +7 -0
- data/examples/app/blog/view/entry/new.nag +13 -0
- data/examples/app/blog/view/entry/show.nag +36 -0
- data/examples/app/blog/view/feed.atom.nag +18 -0
- data/examples/app/blog/view/feed.rss.nag +25 -0
- data/examples/app/blog/view/index.nag +6 -0
- data/examples/app/blog/view/tag/index.nag +5 -0
- data/examples/app/chat/layout/default.xhtml +13 -0
- data/examples/app/chat/model/history.rb +38 -0
- data/examples/app/chat/model/message.rb +7 -0
- data/examples/app/chat/public/css/chat.css +9 -0
- data/examples/app/chat/public/js/chat.js +28 -0
- data/examples/app/chat/public/js/jquery.js +3436 -0
- data/examples/app/chat/start.rb +39 -0
- data/examples/app/chat/view/chat.xhtml +9 -0
- data/examples/app/chat/view/index.xhtml +7 -0
- data/examples/app/localization/locale/de.yaml +5 -0
- data/examples/app/localization/locale/en.yaml +5 -0
- data/examples/app/localization/locale/ja.yaml +5 -0
- data/examples/app/localization/start.rb +48 -0
- data/examples/app/sourceview/public/coderay.css +104 -0
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +11 -0
- data/examples/app/sourceview/public/jquery.treeview.css +48 -0
- data/examples/app/sourceview/public/jquery.treeview.js +223 -0
- data/examples/app/sourceview/public/sourceview.js +52 -0
- data/examples/app/sourceview/start.rb +79 -0
- data/examples/app/sourceview/view/index.haml +59 -0
- data/examples/app/todolist/controller/init.rb +10 -0
- data/examples/app/todolist/controller/task.rb +39 -0
- data/examples/app/todolist/layout/default.xhtml +14 -0
- data/examples/app/todolist/model/init.rb +14 -0
- data/examples/app/todolist/model/task.rb +39 -0
- data/examples/app/todolist/public/css/screen.css +63 -0
- data/examples/app/todolist/public/favicon.ico +0 -0
- data/examples/app/todolist/start.rb +11 -0
- data/examples/app/todolist/view/index.xhtml +29 -0
- data/examples/app/upload/start.rb +19 -0
- data/examples/app/upload/view/index.xhtml +25 -0
- data/examples/app/whywiki/spec/whywiki.rb +58 -0
- data/examples/app/whywiki/start.rb +46 -0
- data/examples/app/whywiki/template/edit.xhtml +14 -0
- data/examples/app/whywiki/template/show.xhtml +18 -0
- data/examples/app/wikore/spec/wikore.rb +109 -0
- data/examples/app/wikore/src/controller.rb +78 -0
- data/examples/app/wikore/src/model.rb +56 -0
- data/examples/app/wikore/start.rb +9 -0
- data/examples/app/wikore/view/index.xhtml +8 -0
- data/examples/app/wiktacular/README +2 -0
- data/examples/app/wiktacular/mkd/link/2007-07-20_19-45-51.mkd +1 -0
- data/examples/app/wiktacular/mkd/link/current.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_16-31-33.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-21-12.mkd +1 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-23-10.mkd +2 -0
- data/examples/app/wiktacular/mkd/main/2007-07-20_19-45-07.mkd +2 -0
- data/examples/app/wiktacular/mkd/main/current.mkd +2 -0
- data/examples/app/wiktacular/mkd/markdown/current.mkd +3 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-20_16-43-46.mkd +2 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-20_19-43-50.mkd +3 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-01.mkd +11 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-46-32.mkd +13 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-08.mkd +17 -0
- data/examples/app/wiktacular/mkd/testing/2007-07-21_18-47-54.mkd +17 -0
- data/examples/app/wiktacular/mkd/testing/current.mkd +17 -0
- data/examples/app/wiktacular/public/favicon.ico +0 -0
- data/examples/app/wiktacular/public/screen.css +72 -0
- data/examples/app/wiktacular/spec/wiktacular.rb +157 -0
- data/examples/app/wiktacular/src/controller.rb +55 -0
- data/examples/app/wiktacular/src/model.rb +102 -0
- data/examples/app/wiktacular/start.rb +8 -0
- data/examples/app/wiktacular/template/edit.xhtml +6 -0
- data/examples/app/wiktacular/template/html_layout.xhtml +27 -0
- data/examples/app/wiktacular/template/index.xhtml +9 -0
- data/examples/app/wiktacular/template/new.xhtml +6 -0
- data/examples/basic/element.rb +47 -0
- data/examples/basic/gestalt.rb +26 -0
- data/examples/basic/hello.rb +14 -0
- data/examples/basic/layout.rb +28 -0
- data/examples/basic/linking.rb +29 -0
- data/examples/basic/partial.rb +26 -0
- data/examples/basic/simple.rb +52 -0
- data/examples/helpers/cache.rb +33 -0
- data/examples/helpers/form_with_sequel.rb +24 -0
- data/examples/helpers/httpdigest.rb +107 -0
- data/examples/helpers/identity.rb +18 -0
- data/examples/helpers/nitro_form.rb +23 -0
- data/examples/helpers/paginate.rb +71 -0
- data/examples/helpers/rest.rb +28 -0
- data/examples/helpers/simple_captcha.rb +29 -0
- data/examples/misc/css.rb +37 -0
- data/examples/misc/facebook.rb +159 -0
- data/examples/misc/memleak_detector.rb +37 -0
- data/examples/misc/nagoro_element.rb +43 -0
- data/examples/misc/ramaise.rb +132 -0
- data/examples/misc/rapp.rb +56 -0
- data/examples/misc/sequel_scaffolding.rb +34 -0
- data/examples/misc/serve_directory.rb +6 -0
- data/examples/templates/template_erubis.rb +52 -0
- data/examples/templates/template_ezamar.rb +51 -0
- data/examples/templates/template_haml.rb +49 -0
- data/examples/templates/template_liquid.rb +66 -0
- data/examples/templates/template_markaby.rb +57 -0
- data/examples/templates/template_nagoro.rb +50 -0
- data/examples/templates/template_redcloth.rb +58 -0
- data/examples/templates/template_remarkably.rb +54 -0
- data/examples/templates/template_tenjin.rb +52 -0
- data/examples/templates/view/external.haml +22 -0
- data/examples/templates/view/external.liquid +28 -0
- data/examples/templates/view/external.mab +30 -0
- data/examples/templates/view/external.nag +28 -0
- data/examples/templates/view/external.redcloth +19 -0
- data/examples/templates/view/external.rem +30 -0
- data/examples/templates/view/external.rhtml +28 -0
- data/examples/templates/view/external.tenjin +28 -0
- data/examples/templates/view/external.zmr +28 -0
- data/lib/proto/app.rb +14 -0
- data/lib/proto/config.ru +20 -0
- data/lib/proto/controller/init.rb +11 -0
- data/lib/proto/controller/main.rb +20 -0
- data/lib/proto/layout/default.xhtml +24 -0
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/.htaccess +24 -0
- data/lib/proto/public/css/screen.css +30 -0
- data/lib/proto/public/dispatch.fcgi +11 -0
- data/lib/proto/public/favicon.ico +0 -0
- data/lib/proto/public/js/jquery.js +4376 -0
- data/lib/proto/public/ramaze.png +0 -0
- data/lib/proto/spec/main.rb +20 -0
- data/lib/proto/start.rb +8 -0
- data/lib/proto/view/index.xhtml +41 -0
- data/lib/ramaze.rb +87 -0
- data/lib/ramaze/app.rb +124 -0
- data/lib/ramaze/cache.rb +19 -0
- data/lib/ramaze/cache/localmemcache.rb +56 -0
- data/lib/ramaze/cache/memcache.rb +124 -0
- data/lib/ramaze/cache/sequel.rb +82 -0
- data/lib/ramaze/contrib/addressable_route.rb +55 -0
- data/lib/ramaze/contrib/app_graph.rb +64 -0
- data/lib/ramaze/contrib/email.rb +88 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +171 -0
- data/lib/ramaze/contrib/gettext.rb +113 -0
- data/lib/ramaze/contrib/gettext/mo.rb +155 -0
- data/lib/ramaze/contrib/gettext/parser.rb +46 -0
- data/lib/ramaze/contrib/gettext/po.rb +109 -0
- data/lib/ramaze/contrib/gzip_filter.rb +1 -0
- data/lib/ramaze/contrib/maruku_uv.rb +59 -0
- data/lib/ramaze/contrib/profiling.rb +36 -0
- data/lib/ramaze/contrib/rest.rb +22 -0
- data/lib/ramaze/contrib/sequel/create_join.rb +26 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
- data/lib/ramaze/contrib/sequel/image.rb +196 -0
- data/lib/ramaze/contrib/sequel/relation.rb +98 -0
- data/lib/ramaze/controller.rb +104 -0
- data/lib/ramaze/controller/default.rb +12 -0
- data/lib/ramaze/current.rb +7 -0
- data/lib/ramaze/files.rb +24 -0
- data/lib/ramaze/gestalt.rb +132 -0
- data/lib/ramaze/helper.rb +13 -0
- data/lib/ramaze/helper/auth.rb +84 -0
- data/lib/ramaze/helper/bench.rb +41 -0
- data/lib/ramaze/helper/cache.rb +117 -0
- data/lib/ramaze/helper/disqus.rb +26 -0
- data/lib/ramaze/helper/flash.rb +62 -0
- data/lib/ramaze/helper/form.rb +127 -0
- data/lib/ramaze/helper/formatting.rb +189 -0
- data/lib/ramaze/helper/gestalt.rb +47 -0
- data/lib/ramaze/helper/gravatar.rb +79 -0
- data/lib/ramaze/helper/httpdigest.rb +97 -0
- data/lib/ramaze/helper/identity.rb +119 -0
- data/lib/ramaze/helper/layout.rb +97 -0
- data/lib/ramaze/helper/link.rb +56 -0
- data/lib/ramaze/helper/localize.rb +138 -0
- data/lib/ramaze/helper/markaby.rb +31 -0
- data/lib/ramaze/helper/maruku.rb +16 -0
- data/lib/ramaze/helper/nitroform.rb +14 -0
- data/lib/ramaze/helper/pager.rb +367 -0
- data/lib/ramaze/helper/paginate.rb +242 -0
- data/lib/ramaze/helper/partial.rb +100 -0
- data/lib/ramaze/helper/remarkably.rb +14 -0
- data/lib/ramaze/helper/request_accessor.rb +16 -0
- data/lib/ramaze/helper/sequel.rb +55 -0
- data/lib/ramaze/helper/sequel_form.rb +284 -0
- data/lib/ramaze/helper/simple_captcha.rb +61 -0
- data/lib/ramaze/helper/stack.rb +75 -0
- data/lib/ramaze/helper/tagz.rb +19 -0
- data/lib/ramaze/helper/thread.rb +17 -0
- data/lib/ramaze/helper/ultraviolet.rb +46 -0
- data/lib/ramaze/helper/user.rb +229 -0
- data/lib/ramaze/helper/xhtml.rb +34 -0
- data/lib/ramaze/log.rb +39 -0
- data/lib/ramaze/log/analogger.rb +39 -0
- data/lib/ramaze/log/growl.rb +38 -0
- data/lib/ramaze/log/hub.rb +41 -0
- data/lib/ramaze/log/informer.rb +129 -0
- data/lib/ramaze/log/knotify.rb +28 -0
- data/lib/ramaze/log/logger.rb +26 -0
- data/lib/ramaze/log/logging.rb +83 -0
- data/lib/ramaze/log/rotatinginformer.rb +168 -0
- data/lib/ramaze/log/syslog.rb +51 -0
- data/lib/ramaze/log/xosd.rb +92 -0
- data/lib/ramaze/middleware_compiler.rb +13 -0
- data/lib/ramaze/plugin.rb +69 -0
- data/lib/ramaze/reloader.rb +172 -0
- data/lib/ramaze/reloader/watch_inotify.rb +85 -0
- data/lib/ramaze/reloader/watch_stat.rb +58 -0
- data/lib/ramaze/request.rb +115 -0
- data/lib/ramaze/response.rb +36 -0
- data/lib/ramaze/setup.rb +123 -0
- data/lib/ramaze/snippets.rb +22 -0
- data/lib/ramaze/snippets/array/put_within.rb +44 -0
- data/lib/ramaze/snippets/binding/locals.rb +25 -0
- data/lib/ramaze/snippets/blankslate.rb +7 -0
- data/lib/ramaze/snippets/fiber.rb +63 -0
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +21 -0
- data/lib/ramaze/snippets/metaid.rb +17 -0
- data/lib/ramaze/snippets/numeric/filesize_format.rb +32 -0
- data/lib/ramaze/snippets/numeric/time.rb +63 -0
- data/lib/ramaze/snippets/object/__dir__.rb +29 -0
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +19 -0
- data/lib/ramaze/snippets/object/pretty.rb +16 -0
- data/lib/ramaze/snippets/object/scope.rb +18 -0
- data/lib/ramaze/snippets/ordered_set.rb +51 -0
- data/lib/ramaze/snippets/proc/locals.rb +19 -0
- data/lib/ramaze/snippets/ramaze/acquire.rb +31 -0
- data/lib/ramaze/snippets/ramaze/deprecated.rb +23 -0
- data/lib/ramaze/snippets/ramaze/dictionary.rb +400 -0
- data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
- data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
- data/lib/ramaze/snippets/string/camel_case.rb +21 -0
- data/lib/ramaze/snippets/string/color.rb +31 -0
- data/lib/ramaze/snippets/string/end_with.rb +20 -0
- data/lib/ramaze/snippets/string/esc.rb +34 -0
- data/lib/ramaze/snippets/string/ord.rb +21 -0
- data/lib/ramaze/snippets/string/snake_case.rb +21 -0
- data/lib/ramaze/snippets/string/start_with.rb +19 -0
- data/lib/ramaze/snippets/string/unindent.rb +28 -0
- data/lib/ramaze/snippets/thread/into.rb +18 -0
- data/lib/ramaze/spec.rb +33 -0
- data/lib/ramaze/spec/bacon.rb +34 -0
- data/lib/ramaze/spec/helper/bacon.rb +8 -0
- data/lib/ramaze/spec/helper/pretty_output.rb +82 -0
- data/lib/ramaze/spec/helper/snippets.rb +16 -0
- data/lib/ramaze/spec/helper/template_examples.rb +19 -0
- data/lib/ramaze/tool/bin.rb +340 -0
- data/lib/ramaze/tool/create.rb +48 -0
- data/lib/ramaze/tool/project_creator.rb +111 -0
- data/lib/ramaze/version.rb +3 -0
- data/lib/ramaze/view.rb +39 -0
- data/lib/ramaze/view/erubis.rb +23 -0
- data/lib/ramaze/view/ezamar.rb +23 -0
- data/lib/ramaze/view/gestalt.rb +14 -0
- data/lib/ramaze/view/haml.rb +16 -0
- data/lib/ramaze/view/liquid.rb +100 -0
- data/lib/ramaze/view/maruku.rb +15 -0
- data/lib/ramaze/view/nagoro.rb +44 -0
- data/lib/ramaze/view/nagoro/render_partial.rb +32 -0
- data/lib/ramaze/view/redcloth.rb +21 -0
- data/lib/ramaze/view/remarkably.rb +21 -0
- data/lib/ramaze/view/sass.rb +21 -0
- data/lib/ramaze/view/tagz.rb +63 -0
- data/lib/ramaze/view/tenjin.rb +32 -0
- data/lib/vendor/etag.rb +22 -0
- data/lib/vendor/route_exceptions.rb +42 -0
- data/ramaze.gemspec +85 -0
- data/spec/contrib/addressable_route.rb +32 -0
- data/spec/contrib/rest.rb +28 -0
- data/spec/examples/caching.rb +16 -0
- data/spec/examples/css.rb +14 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +10 -0
- data/spec/examples/helpers/httpdigest.rb +64 -0
- data/spec/examples/linking.rb +17 -0
- data/spec/examples/simple.rb +40 -0
- data/spec/examples/templates/template_erubis.rb +10 -0
- data/spec/examples/templates/template_ezamar.rb +10 -0
- data/spec/examples/templates/template_haml.rb +10 -0
- data/spec/examples/templates/template_liquid.rb +10 -0
- data/spec/examples/templates/template_markaby.rb +11 -0
- data/spec/examples/templates/template_nagoro.rb +10 -0
- data/spec/examples/templates/template_redcloth.rb +10 -0
- data/spec/examples/templates/template_remarkably.rb +10 -0
- data/spec/examples/templates/template_tenjin.rb +10 -0
- data/spec/helper.rb +9 -0
- data/spec/ramaze/action/render.rb +21 -0
- data/spec/ramaze/action/view/bar.xhtml +1 -0
- data/spec/ramaze/action/view/instancevars/layout.xhtml +1 -0
- data/spec/ramaze/action/view/other_wrapper.erb +1 -0
- data/spec/ramaze/action/view/other_wrapper.xhtml +1 -0
- data/spec/ramaze/action/view/single_wrapper.xhtml +1 -0
- data/spec/ramaze/action/view/sub/sub_wrapper.erb +1 -0
- data/spec/ramaze/action/view/sub/sub_wrapper.xhtml +1 -0
- data/spec/ramaze/app.rb +47 -0
- data/spec/ramaze/bin/ramaze.rb +91 -0
- data/spec/ramaze/cache/localmemcache.rb +49 -0
- data/spec/ramaze/cache/memcache.rb +60 -0
- data/spec/ramaze/cache/sequel.rb +51 -0
- data/spec/ramaze/controller/actionless_templates.rb +36 -0
- data/spec/ramaze/controller/lonely_mapping.rb +16 -0
- data/spec/ramaze/controller/mapping.rb +43 -0
- data/spec/ramaze/controller/provide_inheritance.rb +47 -0
- data/spec/ramaze/controller/resolve.rb +30 -0
- data/spec/ramaze/controller/subclass.rb +36 -0
- data/spec/ramaze/controller/template_resolving.rb +77 -0
- data/spec/ramaze/controller/view/bar.xhtml +1 -0
- data/spec/ramaze/controller/view/base/another.xhtml +1 -0
- data/spec/ramaze/controller/view/greet.xhtml +1 -0
- data/spec/ramaze/controller/view/list.xhtml +1 -0
- data/spec/ramaze/controller/view/other/greet/other.xhtml +1 -0
- data/spec/ramaze/controller/view/other_wrapper.xhtml +1 -0
- data/spec/ramaze/dispatcher/directory.rb +69 -0
- data/spec/ramaze/dispatcher/file.rb +71 -0
- data/spec/ramaze/dispatcher/public/favicon.ico +0 -0
- data/spec/ramaze/dispatcher/public/file name.txt +1 -0
- data/spec/ramaze/dispatcher/public/test_download.css +141 -0
- data/spec/ramaze/error.rb +88 -0
- data/spec/ramaze/files.rb +29 -0
- data/spec/ramaze/files/public_1/plain.txt +1 -0
- data/spec/ramaze/files/public_2/rich.txt +1 -0
- data/spec/ramaze/gestalt.rb +135 -0
- data/spec/ramaze/helper/auth.rb +83 -0
- data/spec/ramaze/helper/bench.rb +18 -0
- data/spec/ramaze/helper/cache.rb +124 -0
- data/spec/ramaze/helper/flash.rb +41 -0
- data/spec/ramaze/helper/form.rb +356 -0
- data/spec/ramaze/helper/formatting.rb +111 -0
- data/spec/ramaze/helper/gestalt.rb +15 -0
- data/spec/ramaze/helper/gravatar.rb +40 -0
- data/spec/ramaze/helper/httpdigest.rb +144 -0
- data/spec/ramaze/helper/layout.rb +79 -0
- data/spec/ramaze/helper/layout/default.xhtml +5 -0
- data/spec/ramaze/helper/link.rb +70 -0
- data/spec/ramaze/helper/localize.rb +62 -0
- data/spec/ramaze/helper/maruku.rb +19 -0
- data/spec/ramaze/helper/pager.rb +96 -0
- data/spec/ramaze/helper/paginate.rb +68 -0
- data/spec/ramaze/helper/request_accessor.rb +19 -0
- data/spec/ramaze/helper/sequel_form.rb +91 -0
- data/spec/ramaze/helper/simple_captcha.rb +45 -0
- data/spec/ramaze/helper/stack.rb +86 -0
- data/spec/ramaze/helper/user.rb +72 -0
- data/spec/ramaze/helper/view/locals.xhtml +1 -0
- data/spec/ramaze/helper/view/loop.xhtml +4 -0
- data/spec/ramaze/helper/view/num.xhtml +1 -0
- data/spec/ramaze/helper/view/partial.xhtml +1 -0
- data/spec/ramaze/helper/view/recursive.xhtml +8 -0
- data/spec/ramaze/helper/view/recursive_local_ivars.xhtml +7 -0
- data/spec/ramaze/helper/view/recursive_locals.xhtml +7 -0
- data/spec/ramaze/helper/view/test_template.xhtml +1 -0
- data/spec/ramaze/helper/xhtml.rb +32 -0
- data/spec/ramaze/log/informer.rb +73 -0
- data/spec/ramaze/log/logging.rb +63 -0
- data/spec/ramaze/log/syslog.rb +73 -0
- data/spec/ramaze/params.rb +153 -0
- data/spec/ramaze/public/favicon.ico +0 -0
- data/spec/ramaze/public/ramaze.png +0 -0
- data/spec/ramaze/public/test_download.css +141 -0
- data/spec/ramaze/request.rb +61 -0
- data/spec/ramaze/rewrite/file.css +1 -0
- data/spec/ramaze/session/memcache.rb +66 -0
- data/spec/ramaze/struct.rb +47 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/ramaze/view.rb +36 -0
- data/spec/ramaze/view/erubis.rb +73 -0
- data/spec/ramaze/view/erubis/external.rhtml +8 -0
- data/spec/ramaze/view/erubis/sum.rhtml +1 -0
- data/spec/ramaze/view/ezamar.rb +73 -0
- data/spec/ramaze/view/ezamar/external.zmr +8 -0
- data/spec/ramaze/view/ezamar/sum.zmr +1 -0
- data/spec/ramaze/view/gestalt.rb +94 -0
- data/spec/ramaze/view/gestalt/external.ges +8 -0
- data/spec/ramaze/view/haml.rb +86 -0
- data/spec/ramaze/view/haml/external.haml +5 -0
- data/spec/ramaze/view/haml/sum.haml +2 -0
- data/spec/ramaze/view/liquid.rb +73 -0
- data/spec/ramaze/view/liquid/external.liquid +8 -0
- data/spec/ramaze/view/liquid/sum.liquid +1 -0
- data/spec/ramaze/view/nagoro.rb +73 -0
- data/spec/ramaze/view/nagoro/external.nag +8 -0
- data/spec/ramaze/view/nagoro/sum.nag +1 -0
- data/spec/ramaze/view/redcloth.rb +66 -0
- data/spec/ramaze/view/redcloth/external.redcloth +8 -0
- data/spec/ramaze/view/remarkably.rb +49 -0
- data/spec/ramaze/view/remarkably/external.rem +8 -0
- data/spec/ramaze/view/remarkably/sum.rem +1 -0
- data/spec/ramaze/view/sass.rb +73 -0
- data/spec/ramaze/view/sass/file.css.sass +5 -0
- data/spec/ramaze/view/tagz.rb +51 -0
- data/spec/ramaze/view/tagz/external.tagz +8 -0
- data/spec/ramaze/view/tagz/sum.tagz +1 -0
- data/spec/ramaze/view/tenjin.rb +57 -0
- data/spec/ramaze/view/tenjin/external.rbhtml +8 -0
- data/spec/ramaze/view/tenjin/sum.rbhtml +1 -0
- data/spec/snippets/array/put_within.rb +33 -0
- data/spec/snippets/binding/locals.rb +9 -0
- data/spec/snippets/numeric/filesize_format.rb +12 -0
- data/spec/snippets/numeric/time.rb +12 -0
- data/spec/snippets/object/__dir__.rb +14 -0
- data/spec/snippets/ordered_set.rb +63 -0
- data/spec/snippets/ramaze/acquire.rb +77 -0
- data/spec/snippets/ramaze/dictionary.rb +110 -0
- data/spec/snippets/ramaze/struct.rb +12 -0
- data/spec/snippets/string/camel_case.rb +25 -0
- data/spec/snippets/string/color.rb +11 -0
- data/spec/snippets/string/snake_case.rb +24 -0
- data/spec/snippets/string/unindent.rb +43 -0
- data/spec/snippets/thread/into.rb +9 -0
- data/tasks/authors.rake +30 -0
- data/tasks/bacon.rake +66 -0
- data/tasks/changelog.rake +20 -0
- data/tasks/copyright.rake +21 -0
- data/tasks/gem.rake +22 -0
- data/tasks/gem_setup.rake +99 -0
- data/tasks/git.rake +46 -0
- data/tasks/grancher.rake +12 -0
- data/tasks/jquery.rake +15 -0
- data/tasks/manifest.rake +4 -0
- data/tasks/metric_changes.rake +24 -0
- data/tasks/rcov.rake +23 -0
- data/tasks/release.rake +54 -0
- data/tasks/reversion.rake +8 -0
- data/tasks/setup.rake +6 -0
- data/tasks/todo.rake +27 -0
- data/tasks/traits.rake +21 -0
- data/tasks/yard.rake +4 -0
- metadata +720 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
require 'ramaze/helper/formatting'
|
3
|
+
|
4
|
+
describe 'Helper::Formatting' do
|
5
|
+
extend Ramaze::Helper::Formatting
|
6
|
+
|
7
|
+
describe '#number_counter' do
|
8
|
+
extend Ramaze::Helper::Formatting
|
9
|
+
|
10
|
+
it 'gives a correct plural counter' do
|
11
|
+
number_counter(0, 'comment').should == 'no comments'
|
12
|
+
number_counter(1, 'comment').should == 'one comment'
|
13
|
+
number_counter(2, 'comment').should == 'two comments'
|
14
|
+
number_counter(3, 'comment').should == 'three comments'
|
15
|
+
number_counter(4, 'comment').should == 'four comments'
|
16
|
+
number_counter(5, 'comment').should == 'five comments'
|
17
|
+
number_counter(6, 'comment').should == 'six comments'
|
18
|
+
number_counter(7, 'comment').should == 'seven comments'
|
19
|
+
number_counter(8, 'comment').should == 'eight comments'
|
20
|
+
number_counter(9, 'comment').should == 'nine comments'
|
21
|
+
number_counter(10, 'comment').should == 'ten comments'
|
22
|
+
number_counter(11, 'comment').should == '11 comments'
|
23
|
+
number_counter(12, 'comment').should == '12 comments'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'uses +items+ as plural version' do
|
27
|
+
number_counter(0, 'pants', 'pants').should == 'no pants'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'tries using the pluralize method on +item+ if no +items+ given' do
|
31
|
+
item = 'person'
|
32
|
+
def item.pluralize; 'people'; end
|
33
|
+
number_counter(0, item).should == 'no people'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'formats numbers' do
|
38
|
+
number_format(2_123_456).should == '2,123,456'
|
39
|
+
number_format(1234.567).should == '1,234.567'
|
40
|
+
number_format(123456.789, '.').should == '123.456,789'
|
41
|
+
number_format(123456.789123, '.').should == '123.456,789123'
|
42
|
+
number_format(132123456.789123, '.').should == '132.123.456,789123'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'returns difference in time as a string' do
|
46
|
+
check = lambda{|diff, string| time_diff(Time.now - diff).should == string }
|
47
|
+
|
48
|
+
check[1, 'less than a minute']
|
49
|
+
check[60, '1 minute']
|
50
|
+
check[60 * 50, 'about 1 hour']
|
51
|
+
check[60 * 120, 'about 2 hours']
|
52
|
+
check[60 * 60 * 24, '1 day']
|
53
|
+
check[60 * 60 * 48, '2 days']
|
54
|
+
check[60 * 60 * 24 * 30, 'about 1 month']
|
55
|
+
check[60 * 60 * 24 * 60, '2 months']
|
56
|
+
check[60 * 60 * 24 * 30 * 20, 'about 1 year']
|
57
|
+
check[60 * 60 * 24 * 30 * 42, 'over 3 years']
|
58
|
+
|
59
|
+
time_diff(Time.now, Time.now + 4, true).should == 'less than 5 seconds'
|
60
|
+
time_diff(Time.now, Time.now + 6, true).should == 'less than 10 seconds'
|
61
|
+
time_diff(Time.now, Time.now + 29, true).should == 'half a minute'
|
62
|
+
time_diff(Time.now, Time.now + 50, true).should == 'less than a minute'
|
63
|
+
time_diff(Time.now, Time.now + 66, true).should == '1 minute'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'linkifies urls' do
|
67
|
+
auto_link("http://ramaze.net is the coolest framework, but <a href='http://merbivore.com'>merb</a> is good too").should ==
|
68
|
+
"<a href=\"http://ramaze.net\">http://ramaze.net</a> is the coolest framework, but <a href='http://merbivore.com'>merb</a> is good too"
|
69
|
+
|
70
|
+
auto_link("http://ramaze.net", :target => '_blank').should ==
|
71
|
+
"<a href=\"http://ramaze.net\" target='_blank'>http://ramaze.net</a>"
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'auto_links urls, setting the result of the given block as the link text' do
|
75
|
+
auto_link('http://ramaze.net rocks, so does http://rubyonrails.org.') { |url| url.sub!(%r{http://}, '') }.should ==
|
76
|
+
'<a href="http://ramaze.net">ramaze.net</a> rocks, so does <a href="http://rubyonrails.org">rubyonrails.org</a>.'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'ordinalizes numbers' do
|
80
|
+
ordinal(1).should == '1st'
|
81
|
+
ordinal(2).should == '2nd'
|
82
|
+
ordinal(3).should == '3rd'
|
83
|
+
ordinal(4).should == '4th'
|
84
|
+
ordinal(10).should == '10th'
|
85
|
+
ordinal(12).should == '12th'
|
86
|
+
ordinal(21).should == '21st'
|
87
|
+
ordinal(23).should == '23rd'
|
88
|
+
ordinal(100).should == '100th'
|
89
|
+
ordinal(133).should == '133rd'
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'generates tagclouds' do
|
93
|
+
tags = %w[ruby ruby code ramaze]
|
94
|
+
tagcloud(tags).should ==
|
95
|
+
{"code"=>0.75, "ramaze"=>0.75, "ruby"=>1.0}
|
96
|
+
tagcloud(tags, 0.5, 2.0).should ==
|
97
|
+
{"code"=>0.875, "ramaze"=>0.875, "ruby"=>1.25}
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'converts newlines to br tags' do
|
101
|
+
nl2br("foo\nbar\nfoobar").should == 'foo<br />bar<br />foobar'
|
102
|
+
nl2br("foo\nbar\nfoobar", false).should == 'foo<br>bar<br>foobar'
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'obfuscates email addresses' do
|
106
|
+
obfuscate_email('foo@example.com').
|
107
|
+
should == "<a href=\"mailto:foo@example.com\">foo@example.com</a>"
|
108
|
+
obfuscate_email('foo@example.com', 'mail foo').
|
109
|
+
should == "<a href=\"mailto:foo@example.com\">mail foo</a>"
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
require 'ramaze/helper/gestalt'
|
3
|
+
|
4
|
+
describe Ramaze::Helper::Gestalt do
|
5
|
+
extend Ramaze::Helper::Gestalt
|
6
|
+
|
7
|
+
it 'has a shortcut for Ramaze::Gestalt::new' do
|
8
|
+
gestalt{ h1('title') }.to_s.should ==
|
9
|
+
Ramaze::Gestalt.new{ h1('title') }.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has a shortcut for Ramaze::Gestalt::build' do
|
13
|
+
build{ h1('title') }.should == '<h1>title</h1>'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
require 'ramaze/helper/gravatar'
|
3
|
+
|
4
|
+
describe Ramaze::Helper::Gravatar do
|
5
|
+
extend Ramaze::Helper::Gravatar
|
6
|
+
|
7
|
+
@email = 'ramaze-spec-gravatar@manveru.oib.com'
|
8
|
+
@digest = Digest::MD5.hexdigest(@email)
|
9
|
+
|
10
|
+
def uri(*tail)
|
11
|
+
URI("http://www.gravatar.com/avatar/#{@digest}#{tail.join}")
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'takes an email and turns it into a hashed part of the uri' do
|
15
|
+
gravatar(@email).should == uri
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'takes :size option' do
|
19
|
+
gravatar(@email, :size => 100).should == uri('?size=100')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'takes :rating option' do
|
23
|
+
gravatar(@email, :rating => 'g').should == uri('?rating=g')
|
24
|
+
gravatar(@email, :rating => 'pg').should == uri('?rating=pg')
|
25
|
+
gravatar(@email, :rating => 'r').should == uri('?rating=r')
|
26
|
+
gravatar(@email, :rating => 'x').should == uri('?rating=x')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'takes :default option' do
|
30
|
+
gravatar(@email, :default => :identicon).should == uri('?default=identicon')
|
31
|
+
gravatar(@email, :default => :monsterid).should == uri('?default=monsterid')
|
32
|
+
gravatar(@email, :default => :wavatar).should == uri('?default=wavatar')
|
33
|
+
gravatar(@email, :default => 'http://example.com/me.jpg').should == uri('?default=http%3A%2F%2Fexample.com%2Fme.jpg')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'takes :force option' do
|
37
|
+
gravatar(@email, :force => true).should == uri('?force=1')
|
38
|
+
gravatar(@email, :force => false).should == uri('')
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
|
3
|
+
REALM = 'HttpDigestTestRealm'
|
4
|
+
|
5
|
+
class MainController < Ramaze::Controller
|
6
|
+
map '/'
|
7
|
+
helper :httpdigest
|
8
|
+
|
9
|
+
def authenticate
|
10
|
+
user = httpdigest('protected', REALM) do |username|
|
11
|
+
Digest::MD5.hexdigest([username, REALM, username.reverse].join(':'))
|
12
|
+
end
|
13
|
+
"Hello #{user}"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class PlainTextController < Ramaze::Controller
|
19
|
+
map '/plaintext'
|
20
|
+
helper :httpdigest
|
21
|
+
|
22
|
+
def authenticate
|
23
|
+
user = httpdigest('protected', REALM)
|
24
|
+
"Hello #{user}"
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
def httpdigest_lookup_plaintext_password(username)
|
30
|
+
username.reverse
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PasswordLookupController < Ramaze::Controller
|
35
|
+
map '/lookup'
|
36
|
+
helper :httpdigest
|
37
|
+
|
38
|
+
def authenticate
|
39
|
+
user = httpdigest('protected', REALM)
|
40
|
+
"Hello #{user}"
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def httpdigest_lookup_password username
|
46
|
+
Digest::MD5.hexdigest([username, REALM, username.reverse].join(':'))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe Ramaze::Helper::HttpDigest do
|
51
|
+
describe 'headers' do
|
52
|
+
behaves_like :rack_test
|
53
|
+
|
54
|
+
it 'sends out all the required header information' do
|
55
|
+
get '/authenticate'
|
56
|
+
www_authenticate = last_response.headers['WWW-Authenticate']
|
57
|
+
authorization = Rack::Auth::Digest::Params.parse(www_authenticate)
|
58
|
+
authorization["opaque"].should.not.be.empty
|
59
|
+
authorization["nonce"].should.not.be.empty
|
60
|
+
authorization["realm"].should == REALM
|
61
|
+
authorization["qop"].should == "auth,auth-int"
|
62
|
+
|
63
|
+
digest_authorize 'foo', 'oof'
|
64
|
+
get '/authenticate'
|
65
|
+
last_response.headers.should.satisfy do |headers|
|
66
|
+
!headers.has_key?( "WWW-Authenticate" )
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
__END__
|
73
|
+
|
74
|
+
describe 'Digest authentication' do
|
75
|
+
behaves_like :rack_test
|
76
|
+
|
77
|
+
it 'authenticates a user with a block' do
|
78
|
+
digest_authorize 'foo', 'oof'
|
79
|
+
get '/authenticate'
|
80
|
+
last_response.status.should == 200
|
81
|
+
last_response.body.should == "Hello foo"
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'fails to authenticate an incorrect password with a block' do
|
85
|
+
digest_authorize 'foo', 'bar'
|
86
|
+
get '/authenticate'
|
87
|
+
last_response.status.should == 401
|
88
|
+
last_response.body.should == "Unauthorized"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'Plaintext authentication' do
|
93
|
+
behaves_like :rack_test
|
94
|
+
|
95
|
+
it 'authenticates a user with the plaintext method' do
|
96
|
+
get '/plaintext/authenticate'
|
97
|
+
last_response.status.should == 401
|
98
|
+
last_response.body.should == 'Unauthorized'
|
99
|
+
|
100
|
+
authorize 'foo', 'oof'
|
101
|
+
get '/plaintext/authenticate'
|
102
|
+
last_response.status.should == 200
|
103
|
+
last_response.body.should == "Hello foo"
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'fails to authenticate an incorrect password with the plaintext method' do
|
107
|
+
authorize 'foo', 'bar'
|
108
|
+
get '/plaintext/authenticate'
|
109
|
+
last_response.status.should == 401
|
110
|
+
last_response.body.should == "Unauthorized"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'authenticates a user with the password lookup method' do
|
115
|
+
got = get_auth( '/lookup/authenticate', 'foo', 'oof' )
|
116
|
+
got.status.should == 200
|
117
|
+
got.body.should == "Hello foo"
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'fails to authenticate an incorrect password with the password lookup method' do
|
121
|
+
got = get_auth( '/lookup/authenticate', 'foo', 'bar' )
|
122
|
+
got.status.should == 401
|
123
|
+
got.body.should == "Unauthorized"
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'authenticates a user with a block using auth-int' do
|
127
|
+
got = get_auth( '/authenticate', 'foo', 'oof', 'auth-int' )
|
128
|
+
got.status.should == 200
|
129
|
+
got.body.should == "Hello foo"
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'authenticates a user with the plaintext method using auth-int' do
|
133
|
+
got = get_auth( '/plaintext/authenticate', 'foo', 'oof', 'auth-int' )
|
134
|
+
got.status.should == 200
|
135
|
+
got.body.should == "Hello foo"
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'authenticates a user with the password lookup method using auth-int' do
|
139
|
+
got = get_auth( '/lookup/authenticate', 'foo', 'oof', 'auth-int' )
|
140
|
+
got.status.should == 200
|
141
|
+
got.body.should == "Hello foo"
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'spec/helper'
|
5
|
+
|
6
|
+
class LayoutHelperOne < Ramaze::Controller
|
7
|
+
map '/one'
|
8
|
+
set_layout 'default'
|
9
|
+
|
10
|
+
def laid_out1; end
|
11
|
+
def laid_out2; end
|
12
|
+
def laid_out3; end
|
13
|
+
end
|
14
|
+
|
15
|
+
class LayoutHelperTwo < Ramaze::Controller
|
16
|
+
map '/two'
|
17
|
+
set_layout 'default' => [:laid_out1, :laid_out2]
|
18
|
+
|
19
|
+
def laid_out1; end
|
20
|
+
def laid_out2; end
|
21
|
+
|
22
|
+
def not_laid_out; end
|
23
|
+
end
|
24
|
+
|
25
|
+
class LayoutHelper < Ramaze::Controller
|
26
|
+
map '/three'
|
27
|
+
set_layout_except 'default' => [:not_laid_out1, :not_laid_out2]
|
28
|
+
|
29
|
+
def laid_out1; end
|
30
|
+
def laid_out2; end
|
31
|
+
|
32
|
+
def not_laid_out1; end
|
33
|
+
def not_laid_out2; end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
describe Ramaze::Helper::Layout do
|
38
|
+
behaves_like :rack_test
|
39
|
+
|
40
|
+
it 'lays out all actions' do
|
41
|
+
get '/one/laid_out1'
|
42
|
+
last_response.status.should == 200
|
43
|
+
last_response.body.should.match /laid out/
|
44
|
+
get '/one/laid_out2'
|
45
|
+
last_response.status.should == 200
|
46
|
+
last_response.body.should.match /laid out/
|
47
|
+
get '/one/laid_out3'
|
48
|
+
last_response.status.should == 200
|
49
|
+
last_response.body.should.match /laid out/
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'lays out only a whitelist of actions' do
|
53
|
+
get '/two/laid_out1'
|
54
|
+
last_response.status.should == 200
|
55
|
+
last_response.body.should.match /laid out/
|
56
|
+
get '/two/laid_out2'
|
57
|
+
last_response.status.should == 200
|
58
|
+
last_response.body.should.match /laid out/
|
59
|
+
get '/two/not_laid_out'
|
60
|
+
last_response.status.should == 200
|
61
|
+
last_response.body.should.not.match /laid out/
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'lays out all actions except a blacklist' do
|
65
|
+
get '/three/laid_out1'
|
66
|
+
last_response.status.should == 200
|
67
|
+
last_response.body.should.match /laid out/
|
68
|
+
get '/three/laid_out2'
|
69
|
+
last_response.status.should == 200
|
70
|
+
last_response.body.should.match /laid out/
|
71
|
+
get '/three/not_laid_out1'
|
72
|
+
last_response.status.should == 200
|
73
|
+
last_response.body.should.not.match /laid out/
|
74
|
+
get '/three/not_laid_out2'
|
75
|
+
last_response.status.should == 200
|
76
|
+
last_response.body.should.not.match /laid out/
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'spec/helper'
|
5
|
+
|
6
|
+
class SpecHelperLink < Ramaze::Controller
|
7
|
+
map '/'
|
8
|
+
end
|
9
|
+
|
10
|
+
class SpecHelperLinkTwo < Ramaze::Controller
|
11
|
+
map '/two'
|
12
|
+
end
|
13
|
+
|
14
|
+
class SpecHelperApp < Ramaze::Controller
|
15
|
+
map '/', :other
|
16
|
+
end
|
17
|
+
|
18
|
+
class SpecHelperAppTwo < Ramaze::Controller
|
19
|
+
map '/two', :other
|
20
|
+
end
|
21
|
+
|
22
|
+
Ramaze::App[:other].location = '/other'
|
23
|
+
|
24
|
+
describe Ramaze::Helper::Link do
|
25
|
+
extend Ramaze::Helper::Link
|
26
|
+
|
27
|
+
it 'lays out breadcrumbs' do
|
28
|
+
SpecHelperLink.breadcrumbs('/file/dir/listing/is/cool').
|
29
|
+
should == [
|
30
|
+
'<a href="/file">file</a>',
|
31
|
+
'<a href="/file/dir">dir</a>',
|
32
|
+
'<a href="/file/dir/listing">listing</a>',
|
33
|
+
'<a href="/file/dir/listing/is">is</a>',
|
34
|
+
'<a href="/file/dir/listing/is/cool">cool</a>'
|
35
|
+
].join('/')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'lays out breadcrumbs with href prefix' do
|
39
|
+
SpecHelperLink.breadcrumbs('/file/dir/listing/is/cool', '/', '/', '/prefix/path').
|
40
|
+
should == [
|
41
|
+
'<a href="/prefix/path/file">file</a>',
|
42
|
+
'<a href="/prefix/path/file/dir">dir</a>',
|
43
|
+
'<a href="/prefix/path/file/dir/listing">listing</a>',
|
44
|
+
'<a href="/prefix/path/file/dir/listing/is">is</a>',
|
45
|
+
'<a href="/prefix/path/file/dir/listing/is/cool">cool</a>'
|
46
|
+
].join('/')
|
47
|
+
end
|
48
|
+
|
49
|
+
it "builds routes and links to other applications" do
|
50
|
+
SpecHelperApp.r(:foo).to_s.should == '/other/foo'
|
51
|
+
SpecHelperApp.a(:foo, :bar).should == '<a href="/other/bar">foo</a>'
|
52
|
+
SpecHelperAppTwo.r(:foo).to_s.should == '/other/two/foo'
|
53
|
+
SpecHelperAppTwo.a(:foo, :bar).should == '<a href="/other/two/bar">foo</a>'
|
54
|
+
end
|
55
|
+
it "builds routes when Ramaze.options.prefix is present" do
|
56
|
+
Ramaze.options.prefix = '/prfx'
|
57
|
+
SpecHelperLink.r(:foo).to_s.should == '/prfx/foo'
|
58
|
+
SpecHelperLinkTwo.r(:foo).to_s.should == '/prfx/two/foo'
|
59
|
+
SpecHelperApp.r(:foo).to_s.should == '/prfx/other/foo'
|
60
|
+
SpecHelperAppTwo.r(:foo).to_s.should == '/prfx/other/two/foo'
|
61
|
+
|
62
|
+
end
|
63
|
+
it "builds links when Ramaze.options.prefix is present" do
|
64
|
+
Ramaze.options.prefix = '/prfx'
|
65
|
+
SpecHelperLink.a(:foo, :bar).should == '<a href="/prfx/bar">foo</a>'
|
66
|
+
SpecHelperLinkTwo.a(:foo, :bar).should == '<a href="/prfx/two/bar">foo</a>'
|
67
|
+
SpecHelperApp.a(:foo, :bar).should == '<a href="/prfx/other/bar">foo</a>'
|
68
|
+
SpecHelperAppTwo.a(:foo, :bar).should == '<a href="/prfx/other/two/bar">foo</a>'
|
69
|
+
end
|
70
|
+
end
|