rango 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/CONTRIBUTORS +1 -0
- data/README.textile +4 -1
- data/bin/rango +1 -1
- data/lib/rango.rb +78 -12
- data/lib/rango/contrib/pagination.rb +2 -0
- data/lib/rango/controller.rb +58 -12
- data/lib/rango/environments.rb +26 -0
- data/lib/rango/exceptions.rb +2 -14
- data/lib/rango/gv.rb +7 -90
- data/lib/rango/gv/static.rb +22 -0
- data/lib/rango/helpers.rb +0 -1
- data/lib/rango/helpers/assets.rb +2 -0
- data/lib/rango/helpers/general.rb +1 -0
- data/lib/rango/helpers/syntax.rb +2 -0
- data/lib/rango/mini.rb +30 -0
- data/lib/rango/mixins/application.rb +5 -3
- data/lib/rango/mixins/configurable.rb +1 -0
- data/lib/rango/mixins/render.rb +13 -84
- data/lib/rango/orm/tasks/datamapper.rake +2 -2
- data/lib/rango/project.rb +2 -2
- data/lib/rango/rack/middlewares/basic.rb +15 -11
- data/lib/rango/rack/request.rb +5 -3
- data/lib/rango/router.rb +20 -2
- data/lib/rango/router/adapters/rack_mount.rb +0 -1
- data/lib/rango/router/adapters/rack_router.rb +0 -1
- data/lib/rango/router/adapters/urlmap.rb +0 -1
- data/lib/rango/router/adapters/usher.rb +0 -1
- data/lib/rango/settings/framework.rb +2 -43
- data/lib/rango/templates/{erubis.rb → exts/erubis.rb} +0 -19
- data/lib/rango/templates/exts/tilt.rb +16 -0
- data/lib/rango/templates/helpers.rb +107 -0
- data/lib/rango/templates/template.rb +44 -115
- data/lib/rango/utils.rb +9 -4
- data/spec/rango/controller_spec.rb +3 -1
- data/spec/rango/environments_spec.rb +68 -0
- data/spec/rango/gv_spec.rb +10 -0
- data/spec/rango/mini_spec.rb +58 -0
- data/spec/rango/project_spec.rb +1 -1
- data/spec/rango/templates/template_spec.rb +81 -0
- data/spec/rango/utils_spec.rb +33 -0
- data/spec/rango_spec.rb +3 -17
- data/spec/spec_helper.rb +5 -3
- data/spec/stubs/config.ru +5 -0
- data/spec/stubs/templates/capture.html.erb +1 -1
- data/spec/stubs/templates/erubis.html.erubis +2 -0
- data/spec/stubs/templates/inheritance/basic/base.html.haml +2 -0
- data/spec/stubs/templates/inheritance/basic/index.html.haml +2 -0
- data/spec/stubs/templates/inheritance/capture/erb/base.html.erb +3 -0
- data/spec/stubs/templates/inheritance/capture/erb/index.html.erb +4 -0
- data/spec/stubs/templates/inheritance/capture/erubis/base.html.erubis +3 -0
- data/spec/stubs/templates/inheritance/capture/erubis/index.html.erubis +4 -0
- data/spec/stubs/templates/inheritance/capture/haml/base.html.haml +2 -0
- data/spec/stubs/templates/inheritance/capture/haml/index.html.haml +3 -0
- data/spec/stubs/templates/test.html.haml +1 -0
- data/spec/stubs/templates/variables.html.haml +1 -0
- data/stubs/app/content/init.rb.rbt +2 -1
- data/stubs/app/content/views.rb.rbt +2 -0
- data/stubs/bigapp/content/views/%controller%.rb.rbt +2 -0
- data/stubs/project/content/config.ru.rbt +3 -0
- data/stubs/project/content/init.rb.rbt +11 -5
- data/stubs/project/content/settings.rb +0 -2
- data/stubs/project/content/settings_local.rb.rbt +1 -1
- data/stubs/project/content/templates/base.html.haml.rbt +1 -0
- metadata +42 -329
- data/examples/README.textile +0 -12
- data/examples/blog/Gemfile +0 -80
- data/examples/blog/Rakefile +0 -12
- data/examples/blog/TODO.txt +0 -0
- data/examples/blog/bin/autospec +0 -3
- data/examples/blog/bin/css2sass +0 -3
- data/examples/blog/bin/cucumber +0 -3
- data/examples/blog/bin/haml +0 -3
- data/examples/blog/bin/html2haml +0 -3
- data/examples/blog/bin/htmldiff +0 -3
- data/examples/blog/bin/launchy +0 -3
- data/examples/blog/bin/ldiff +0 -3
- data/examples/blog/bin/nokogiri +0 -3
- data/examples/blog/bin/racksh +0 -3
- data/examples/blog/bin/rackup +0 -3
- data/examples/blog/bin/rake +0 -3
- data/examples/blog/bin/rango +0 -3
- data/examples/blog/bin/sass +0 -3
- data/examples/blog/bin/shotgun +0 -3
- data/examples/blog/bin/simple-templater +0 -3
- data/examples/blog/bin/spec +0 -3
- data/examples/blog/bin/tt +0 -3
- data/examples/blog/blog/init.rb +0 -9
- data/examples/blog/blog/models.rb +0 -21
- data/examples/blog/blog/views.rb +0 -16
- data/examples/blog/config.ru +0 -19
- data/examples/blog/gems/cache/addressable-2.1.1.gem +0 -0
- data/examples/blog/gems/cache/builder-2.1.2.gem +0 -0
- data/examples/blog/gems/cache/bundler-0.7.0.gem +0 -0
- data/examples/blog/gems/cache/cli-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/configuration-1.1.0.gem +0 -0
- data/examples/blog/gems/cache/cucumber-0.4.4.gem +0 -0
- data/examples/blog/gems/cache/data_objects-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/diff-lcs-1.1.2.gem +0 -0
- data/examples/blog/gems/cache/dm-core-0.10.1.gem +0 -0
- data/examples/blog/gems/cache/dm-timestamps-0.10.1.gem +0 -0
- data/examples/blog/gems/cache/do_mysql-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/do_sqlite3-0.10.0.gem +0 -0
- data/examples/blog/gems/cache/extlib-0.9.13.gem +0 -0
- data/examples/blog/gems/cache/fuzzyhash-0.0.9.gem +0 -0
- data/examples/blog/gems/cache/haml-2.2.14.gem +0 -0
- data/examples/blog/gems/cache/launchy-0.3.3.gem +0 -0
- data/examples/blog/gems/cache/media-path-0.1.gem +0 -0
- data/examples/blog/gems/cache/nokogiri-1.4.0.gem +0 -0
- data/examples/blog/gems/cache/polyglot-0.2.9.gem +0 -0
- data/examples/blog/gems/cache/rack-1.0.1.gem +0 -0
- data/examples/blog/gems/cache/rack-test-0.5.2.gem +0 -0
- data/examples/blog/gems/cache/racksh-0.9.4.2.gem +0 -0
- data/examples/blog/gems/cache/rake-0.8.7.gem +0 -0
- data/examples/blog/gems/cache/rango-0.1.0.gem +0 -0
- data/examples/blog/gems/cache/rspec-1.2.9.gem +0 -0
- data/examples/blog/gems/cache/rubyexts-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/shotgun-0.4.gem +0 -0
- data/examples/blog/gems/cache/simple-templater-0.0.1.gem +0 -0
- data/examples/blog/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/examples/blog/gems/cache/treetop-1.4.2.gem +0 -0
- data/examples/blog/gems/cache/usher-0.5.11.gem +0 -0
- data/examples/blog/gems/cache/webrat-0.5.3.gem +0 -0
- data/examples/blog/init.rb +0 -49
- data/examples/blog/settings.rb +0 -15
- data/examples/blog/settings_local.rb +0 -6
- data/examples/blog/spec/blog/init_spec.rb +0 -7
- data/examples/blog/spec/blog/models_spec.rb +0 -28
- data/examples/blog/spec/blog/views_spec.rb +0 -22
- data/examples/blog/spec/spec.opts +0 -5
- data/examples/blog/spec/spec_helper.rb +0 -27
- data/examples/blog/templates/base.html.haml +0 -16
- data/examples/blog/templates/index.html.haml +0 -12
- data/lib/rango/boot.rb +0 -55
- data/lib/rango/helpers/README +0 -179
- data/lib/rango/helpers/merb-helpers.rb +0 -3
- data/lib/rango/helpers/merb-helpers/core_ext.rb +0 -58
- data/lib/rango/helpers/merb-helpers/core_ext/numeric.rb +0 -389
- data/lib/rango/helpers/merb-helpers/date_time_formatting.rb +0 -146
- data/lib/rango/helpers/merb-helpers/date_time_helpers.rb +0 -191
- data/lib/rango/helpers/merb-helpers/form/builder.rb +0 -450
- data/lib/rango/helpers/merb-helpers/form/helpers.rb +0 -453
- data/lib/rango/helpers/merb-helpers/form_helpers.rb +0 -21
- data/lib/rango/helpers/merb-helpers/tag_helpers.rb +0 -63
- data/lib/rango/helpers/merb-helpers/text_helpers.rb +0 -73
- data/lib/rango/loggers/logger.rb +0 -100
- data/lib/rango/mixins/chainable.rb +0 -68
- data/lib/rango/mixins/hookable.rb +0 -32
- data/lib/rango/mixins/import.rb +0 -89
- data/lib/rango/mixins/mini.rb +0 -29
- data/lib/rango/mixins/strategy.rb +0 -28
- data/lib/rango/rango.rb +0 -93
- data/lib/rango/router/specification.txt +0 -11
- data/lib/rango/templates/adapter.rb +0 -19
- data/lib/rango/templates/adapters/erb.rb +0 -63
- data/lib/rango/templates/adapters/erubis.rb +0 -65
- data/lib/rango/templates/adapters/haml.rb +0 -26
- data/lib/rango/templates/templates.txt +0 -39
- data/spec/factories.rb +0 -22
- data/spec/rango/boot_spec.rb +0 -15
- data/spec/rango/helpers/merb-helpers/core_ext/numeric_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/core_ext_spec.rb +0 -21
- data/spec/rango/helpers/merb-helpers/date_time_formatting_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/date_time_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/application.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_check_box.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_file_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_hidden_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_option_tag.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_password_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_radio_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_radio_group.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_select.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_text_area.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/bound_text_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/check_box.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/custom_builder.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/delete_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/exceptions.rb +0 -25
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/field_set.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/fields_for.rb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/file_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/foo.rb +0 -23
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/form.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/form_for.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/hacker.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/hidden_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/label.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/numeric_ext.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/option_tag.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/password_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/radio_button.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/radio_group.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/relative_date.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/relative_date_span.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/select.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/specs_controller.rb +0 -13
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/submit.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/tag_helper.rb +0 -23
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/text_area.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/controllers/text_field.rb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/helpers/global_helpers.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/models/fake_dm_model.rb +0 -27
- data/spec/rango/helpers/merb-helpers/fixture/app/models/first_generic_fake_model.rb +0 -59
- data/spec/rango/helpers/merb-helpers/fixture/app/models/hacker_generic_model.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/models/second_generic_fake_model.rb +0 -20
- data/spec/rango/helpers/merb-helpers/fixture/app/models/third_generic_fake_model.rb +0 -5
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/basic.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/basic_unchecked.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/checked.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/errors.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/on_and_off.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_check_box_specs/raise_value_error.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/additional_attributes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/takes_string.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_file_field_specs/with_label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/errors.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/hidden_error.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_hidden_field_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/grouped.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/nested.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_option_tag_specs/text_and_value.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/attributes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_password_field_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_button_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/hashes.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/mixed.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_radio_group_specs/override_id.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/blank.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/multiple.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/prompt.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/with_options.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_select_specs/with_options_with_blank.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_area_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_area_specs/label.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/bound_text_field_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/button_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/button_with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/button_specs/disabled_button.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/on_off_is_boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raise_unless_both_on_and_off.html.erb +0 -2
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raises_error_if_not_boolean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/raises_error_if_on_off_and_boolean_false.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/simple.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/to_string.html.erb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/app/views/check_box_specs/unchecked.html.erb +0 -2
- data/spec/rango/helpers/merb-helpers/fixture/app/views/custom_builder_specs/everything.html.erb +0 -10
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_explicit_url.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_extra_params.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/delete_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/delete_button_specs/simple_delete.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/client_error.html.erb +0 -37
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/internal_server_error.html.erb +0 -216
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/not_acceptable.html.erb +0 -38
- data/spec/rango/helpers/merb-helpers/fixture/app/views/exeptions/not_found.html.erb +0 -40
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/midstream.html.erb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fields_for_specs/nil.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/fieldset_specs/legend.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/makes_multipart.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/file_field_specs/with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/foo/bar.html.erb +0 -0
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_for_specs/basic.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/create_a_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/create_a_multipart_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/fake_delete_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/fake_put_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/get_if_set.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/post_by_default.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/form_specs/resourceful_form.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/file_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/hidden_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/option_tag.html.erb +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/password_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/radio_button.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/radio_group.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/text_area.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hacker/text_field.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/hidden_field_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic_with_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/label_specs/basic_with_class.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/layout/application.html.erb +0 -11
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/minutes_to_hours.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/to_concurrency_default.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/numeric_ext_specs/two_digits.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/array.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/clean.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/collection.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/multiple_selects.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/no_extra_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/optgroups.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/selected.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/with_blank.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/option_tag_specs/with_prompt.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/password_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/password_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/checked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_button_specs/unchecked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/checked.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/hash.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/radio_group_specs/specific_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_span_specs/date_span_on_same_day.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_span_specs/date_span_on_same_day_on_different_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_date_with_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_date_without_year.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_today.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_tomorrow.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/relative_date_specs/relative_yesterday.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/blank.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/multiple.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/select_specs/selected.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/disabled_submit.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/submit_with_label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/submit_specs/submit_with_values.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/nested_tags.html.erb +0 -5
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_attributes.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_content.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/tag_helper/tag_with_content_in_the_block.html.erb +0 -3
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_area_specs/nil.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/basic.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/class.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/disabled.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/label.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/app/views/text_field_specs/symbolized_name.html.erb +0 -1
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/development.rb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/production.rb +0 -7
- data/spec/rango/helpers/merb-helpers/fixture/config/environments/test.rb +0 -8
- data/spec/rango/helpers/merb-helpers/fixture/config/init.rb +0 -48
- data/spec/rango/helpers/merb-helpers/fixture/config/rack.rb +0 -13
- data/spec/rango/helpers/merb-helpers/fixture/config/router.rb +0 -40
- data/spec/rango/helpers/merb-helpers/fixture/public/images/merb.jpg +0 -0
- data/spec/rango/helpers/merb-helpers/fixture/public/merb.fcgi +0 -4
- data/spec/rango/helpers/merb-helpers/fixture/public/stylesheets/master.css +0 -119
- data/spec/rango/helpers/merb-helpers/form/builder_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/form/helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/form_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/merb_helpers_config_spec.rb +0 -85
- data/spec/rango/helpers/merb-helpers/merb_helpers_date_time_spec.rb +0 -270
- data/spec/rango/helpers/merb-helpers/merb_helpers_form_spec.rb +0 -1372
- data/spec/rango/helpers/merb-helpers/merb_helpers_tag_helper_spec.rb +0 -46
- data/spec/rango/helpers/merb-helpers/merb_helpers_text_spec.rb +0 -71
- data/spec/rango/helpers/merb-helpers/numeric_extlib_spec.rb +0 -138
- data/spec/rango/helpers/merb-helpers/ordinalize_spec.rb +0 -55
- data/spec/rango/helpers/merb-helpers/tag_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers/text_helpers_spec.rb +0 -0
- data/spec/rango/helpers/merb-helpers_spec.rb +0 -0
- data/spec/rango/mixins/chainable_spec.rb +0 -0
- data/spec/rango/mixins/hookable_spec.rb +0 -0
- data/spec/rango/mixins/import_spec.rb +0 -0
- data/spec/rango/mixins/mini_spec.rb +0 -0
- data/spec/rango/mixins/strategy_spec.rb +0 -0
- data/spec/rango/rango_spec.rb +0 -0
- data/spec/rango/templates/adapter_spec.rb +0 -0
- data/spec/rango/templates/adapters/erb_spec.rb +0 -0
- data/spec/rango/templates/adapters/erubis_spec.rb +0 -117
- data/spec/rango/templates/adapters/haml_spec.rb +0 -0
- data/spec/rango/templates/adapters/template_helpers.rb +0 -38
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../../../spec_helper"
|
4
|
-
require "rango/helpers/merb-helpers/tag_helpers"
|
5
|
-
|
6
|
-
__END__
|
7
|
-
TODO: rewrite to not send any requests
|
8
|
-
|
9
|
-
# Rango::Router.prepare do
|
10
|
-
# default_routes
|
11
|
-
# end
|
12
|
-
|
13
|
-
describe Rango::Helpers::Tag do
|
14
|
-
include Rango::Helpers::Tag
|
15
|
-
|
16
|
-
describe "#tag" do
|
17
|
-
it 'generates <div>content</div> from tag :div, "content"' do
|
18
|
-
response = request "/tag_helper/tag_with_content"
|
19
|
-
|
20
|
-
response.should have_selector("div")
|
21
|
-
response.body.to_s.should include("Astral Projection ~ Dancing Galaxy")
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'outputs content returned by the block when block is given' do
|
25
|
-
response = request "/tag_helper/tag_with_content_in_the_block"
|
26
|
-
|
27
|
-
response.should have_selector("div")
|
28
|
-
response.body.should include("Astral Projection ~ Trust in Trance 1")
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'generates tag attributes for all of keys of last Hash' do
|
32
|
-
response = request "/tag_helper/tag_with_attributes"
|
33
|
-
|
34
|
-
response.should have_selector("div.psy")
|
35
|
-
response.should have_selector("div#bands")
|
36
|
-
response.should have_selector("div[invalid_attr='at least in html']")
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'handles nesting of tags/blocks' do
|
40
|
-
response = request "/tag_helper/nested_tags"
|
41
|
-
|
42
|
-
response.should have_selector("div.discography ul.albums li.first")
|
43
|
-
response.should have_selector("#tit:contains('Trust in Trance 2')")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
__END__
|
4
|
-
require_relative "../../../spec_helper"
|
5
|
-
require "rango/helpers/merb-helpers/text_helpers"
|
6
|
-
|
7
|
-
describe "cycle" do
|
8
|
-
include Rango::Helpers::Text
|
9
|
-
|
10
|
-
it "do basic cycling" do
|
11
|
-
cycle("one", 2, "3").should == 'one'
|
12
|
-
cycle("one", 2, "3").should == '2'
|
13
|
-
cycle("one", 2, "3").should == '3'
|
14
|
-
cycle("one", 2, "3").should == 'one'
|
15
|
-
cycle("one", 2, "3").should == '2'
|
16
|
-
cycle("one", 2, "3").should == '3'
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should reset with new values" do
|
20
|
-
cycle("even", "odd").should == 'even'
|
21
|
-
cycle("even", "odd").should == 'odd'
|
22
|
-
cycle("even", "odd").should == 'even'
|
23
|
-
cycle("even", "odd").should == 'odd'
|
24
|
-
cycle(1, 2, 3).should == '1'
|
25
|
-
cycle(1, 2, 3).should == '2'
|
26
|
-
cycle(1, 2, 3).should == '3'
|
27
|
-
cycle(1, 2, 3).should == '1'
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should support named cycles" do
|
31
|
-
cycle(1, 2, 3, :name => "numbers").should == "1"
|
32
|
-
cycle("red", "blue", :name => "colors").should == "red"
|
33
|
-
cycle(1, 2, 3, :name => "numbers").should == "2"
|
34
|
-
cycle("red", "blue", :name => "colors").should == "blue"
|
35
|
-
cycle(1, 2, 3, :name => "numbers").should == "3"
|
36
|
-
cycle("red", "blue", :name => "colors").should == "red"
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should use a named cycle called 'default' by default" do
|
40
|
-
cycle(1, 2, 3).should == "1"
|
41
|
-
cycle(1, 2, 3, :name => "default").should == "2"
|
42
|
-
cycle(1, 2, 3).should == "3"
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be able to be reset" do
|
46
|
-
cycle(1, 2, 3).should == "1"
|
47
|
-
cycle(1, 2, 3).should == "2"
|
48
|
-
reset_cycle
|
49
|
-
cycle(1, 2, 3).should == "1"
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should be able to reset a named cycle" do
|
53
|
-
cycle(1, 2, 3, :name => "numbers").should == "1"
|
54
|
-
cycle("red", "blue", :name => "colors").should == "red"
|
55
|
-
reset_cycle("numbers")
|
56
|
-
cycle(1, 2, 3, :name => "numbers").should == "1"
|
57
|
-
cycle("red", "blue", :name => "colors").should == "blue"
|
58
|
-
cycle(1, 2, 3, :name => "numbers").should == "2"
|
59
|
-
cycle("red", "blue", :name => "colors").should == "red"
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should work with things other than strings" do
|
63
|
-
class Red; def to_s; 'red'; end; end;
|
64
|
-
class Blue; def to_s; 'blue'; end; end;
|
65
|
-
red = Red.new
|
66
|
-
blue = Blue.new
|
67
|
-
cycle(red, blue).should == "red"
|
68
|
-
cycle(red, blue).should == "blue"
|
69
|
-
cycle(red, blue).should == "red"
|
70
|
-
end
|
71
|
-
end
|
@@ -1,138 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../../../spec_helper"
|
4
|
-
require "rango/helpers/merb-helpers/core_ext/numeric"
|
5
|
-
|
6
|
-
describe "Numeric helpers" do
|
7
|
-
|
8
|
-
before :each do
|
9
|
-
#@controller = NumericExtSpecs.new(Rango::Request.new({}))
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "with_delimiter" do
|
13
|
-
|
14
|
-
before(:each) do
|
15
|
-
@number = 12345678
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should use the default formatting for numbers" do
|
19
|
-
@number.with_delimiter.should == "12,345,678"
|
20
|
-
@number.with_delimiter.should == @number.with_delimiter(:us)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should support passing another format" do
|
24
|
-
@number.with_delimiter(:fr).should == "12 345 678"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should support passing overwriting options" do
|
28
|
-
@number.with_delimiter(:fr, :delimiter => ',').should == "12,345,678"
|
29
|
-
12345678.9.with_delimiter(:fr, :separator => ' et ').should == "12 345 678 et 9"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
describe "with_precision" do
|
35
|
-
it "should use a default precision" do
|
36
|
-
111.2345.with_precision.should == "111.235"
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should support other precision formats" do
|
40
|
-
111.2345.with_precision(:uk).should == "111.235"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should support overwriting precision options" do
|
44
|
-
111.2345.with_precision(:uk, :precision => 1).should == "111.2"
|
45
|
-
1234.567.with_precision(:us, :precision => 1, :separator => ',', :delimiter => '-').should == "1-234,6"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
describe "to_concurrency" do
|
51
|
-
|
52
|
-
before(:each) do
|
53
|
-
@number = 1234567890.50
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should use the US$ by default" do
|
57
|
-
@number.to_currency.should == "$1,234,567,890.50"
|
58
|
-
@number.to_currency.should == @number.to_currency(:us)
|
59
|
-
@number.to_currency.should == @number.to_currency(:default)
|
60
|
-
#result = @controller.render :to_concurrency_default
|
61
|
-
#result.should == "$1,234,567,890.50"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should use the precision settings of the format" do
|
65
|
-
1234567890.506.to_currency(:us).should == "$1,234,567,890.51"
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should support other formats" do
|
69
|
-
@number.to_currency(:uk).should == "£1,234,567,890.50"
|
70
|
-
@number.to_currency(:fr).should == "1 234 567 890,50€"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should support overwriting options" do
|
74
|
-
1234567890.506.to_currency(:us, :precision => 1).should == "$1,234,567,890.5"
|
75
|
-
1234567890.516.to_currency(:us, :unit => "€").should == "€1,234,567,890.52"
|
76
|
-
1234567890.506.to_currency(:us, :precision => 3, :unit => "€").should == "€1,234,567,890.506"
|
77
|
-
1234567890.506.to_currency(:aus, :unit => "$AUD", :format => '%n %u').should == "1,234,567,890.51 $AUD"
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "Numeric::Transformer formats" do
|
83
|
-
|
84
|
-
it "should be able to add a new format" do
|
85
|
-
Numeric::Transformer.default_format.should be_instance_of(Hash)
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should be able to change the default format" do
|
89
|
-
original_default_format = Numeric::Transformer.default_format
|
90
|
-
original_default_format[:currency][:unit].should == "$"
|
91
|
-
Numeric::Transformer.change_default_format(:fr)
|
92
|
-
Numeric::Transformer.default_format.should_not == original_default_format
|
93
|
-
Numeric::Transformer.default_format[:currency][:unit].should == "€"
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should be able to add a format" do
|
97
|
-
merb_format = {:merb =>
|
98
|
-
{ :number => {
|
99
|
-
:precision => 3,
|
100
|
-
:delimiter => ' ',
|
101
|
-
:separator => ','
|
102
|
-
},
|
103
|
-
:currency => {
|
104
|
-
:unit => 'Rangoollars',
|
105
|
-
:format => '%n %u',
|
106
|
-
:precision => 2
|
107
|
-
}
|
108
|
-
}
|
109
|
-
}
|
110
|
-
Numeric::Transformer.add_format(merb_format)
|
111
|
-
Numeric::Transformer.change_default_format(:merb)
|
112
|
-
12345.to_currency.should == "12 345,00 Rangoollars"
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "other misc numeric helpers" do
|
118
|
-
|
119
|
-
describe "two_digits" do
|
120
|
-
it "should convert a numeric value in a 2 digit string (prepend with a zero if needed)" do
|
121
|
-
7.two_digits.should == "07"
|
122
|
-
#result = @controller.render :two_digits
|
123
|
-
#result.should == "07"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe "minutes_to_hours" do
|
128
|
-
it "should convert a number of minutes into an hour representation" do
|
129
|
-
#result = @controller.render :minutes_to_hours
|
130
|
-
#result.should == "05:15"
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
|
138
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
__END__
|
4
|
-
require_relative "../../../spec_helper"
|
5
|
-
require "rango/helpers/merb-helpers/date_time_formatting"
|
6
|
-
|
7
|
-
describe "#strftime_ordinalized" do
|
8
|
-
|
9
|
-
before(:all) do
|
10
|
-
@date = Date.parse('2008-5-3')
|
11
|
-
@time = Time.parse('2008-5-3 14:00')
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should ordinalize a date even without a locale passed" do
|
15
|
-
@date.strftime_ordinalized('%b %d, %Y').should == "May 3rd, 2008"
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "to_ordinalized_s" do
|
21
|
-
|
22
|
-
before(:each) do
|
23
|
-
@date = Date.parse('2008-5-3')
|
24
|
-
@time = Time.parse('2008-5-3 14:00')
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should render a date using #to_s if no format is passed" do
|
28
|
-
@date.to_ordinalized_s.should == @date.to_s
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should render a time using #to_s if no format is passed" do
|
32
|
-
@time.to_ordinalized_s.should == @time.to_s
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should render a date or time using the db format" do
|
36
|
-
@date.to_ordinalized_s(:db).should == "2008-05-03 00:00:00"
|
37
|
-
@time.to_ordinalized_s(:db).should == "2008-05-03 14:00:00"
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should render a date or time using the long format" do
|
41
|
-
@date.to_ordinalized_s(:long).should == "May 3rd, 2008 00:00"
|
42
|
-
@time.to_ordinalized_s(:long).should == "May 3rd, 2008 14:00"
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should render a date or time using the time format" do
|
46
|
-
@date.to_ordinalized_s(:time).should == "00:00"
|
47
|
-
@time.to_ordinalized_s(:time).should == "14:00"
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should render a date or a time using the short format" do
|
51
|
-
@date.to_ordinalized_s(:short).should == "3rd May 00:00"
|
52
|
-
@time.to_ordinalized_s(:short).should == "3rd May 14:00"
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/rango/rango_spec.rb
DELETED
File without changes
|
File without changes
|
File without changes
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "template_helpers"
|
4
|
-
require "rango/templates/adapters/erubis"
|
5
|
-
|
6
|
-
describe Rango::Templates::ErubisAdapter do
|
7
|
-
include TemplateHelpers
|
8
|
-
before(:each) do
|
9
|
-
@engine = Rango::Templates::ErubisAdapter.new
|
10
|
-
@template = template("basic.html.erb")
|
11
|
-
Project.settings = settings(erubis: {pattern: "<% %>", custom_class: nil})
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#render" do
|
15
|
-
it "should render template" do
|
16
|
-
body = @engine.render(@template)
|
17
|
-
body.should match("<h1>")
|
18
|
-
body.should match("3#")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should work with context" do
|
22
|
-
template = template("context.html.erb")
|
23
|
-
body = @engine.render(template, who: "Rango")
|
24
|
-
body.should match("<h1>Hello Rango!</h1>")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should works with instance variables" do
|
28
|
-
pending "Without binding instance variables don't work" do
|
29
|
-
@title = "Hello There!"
|
30
|
-
body = @engine.render(@template)
|
31
|
-
body.should match("<h1>Hello There!</h1>")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should use class from Project.settings.erubis.custom_class" do
|
36
|
-
MockedEruby = mock("Erubis::MockedEruby")
|
37
|
-
options = {pattern: Project.settings.erubis.pattern, filename: @template.path}
|
38
|
-
content = @template.read
|
39
|
-
engine = Erubis::Eruby.new(content, options)
|
40
|
-
MockedEruby.should_receive(:new).with(content, options).and_return(engine)
|
41
|
-
Project.settings.erubis.custom_class = MockedEruby
|
42
|
-
@engine.render(File.new(@template.path))
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should Project.settings.erubis.pattern" do
|
46
|
-
pending "Probably Erubis problem [issue #69]" do
|
47
|
-
Project.settings.erubis.pattern = "[$ $]"
|
48
|
-
file = edit_template { |content| content.gsub("<%", "[$").gsub("<%", "[$") }
|
49
|
-
body = @engine.render(file)
|
50
|
-
body.should match("<h1>")
|
51
|
-
body.should match("3#")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should point to proper file and line" do
|
56
|
-
begin
|
57
|
-
@engine.render(@template)
|
58
|
-
rescue Exception => exception
|
59
|
-
path, line, where = exception.backtrace.first.split(":")
|
60
|
-
path.should eql("")
|
61
|
-
line.should == "1"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "autoescaping" do
|
66
|
-
before(:each) do
|
67
|
-
@template = template("context.html.erb")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should autoescape evaluated expression if Project.settings.autoescape is true" do
|
71
|
-
Project.settings.template.autoescape = true
|
72
|
-
body = @engine.render(@template, who: "<b>Rango</b>")
|
73
|
-
body.should match("<h1>Hello <b>Rango</b>!</h1>")
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should not autoescape evaluated expression if Project.settings.autoescape is false" do
|
77
|
-
Project.settings.template.autoescape = false
|
78
|
-
body = @engine.render(@template, who: "<b>Rango</b>")
|
79
|
-
body.should match("<h1>Hello <b>Rango</b>!</h1>")
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "caching" do
|
84
|
-
after(:each) { clean_cache }
|
85
|
-
it "should cache templates if Project.settings.template.caching is true" do
|
86
|
-
Project.settings.template.caching = true
|
87
|
-
@engine.render(@template)
|
88
|
-
File.exist?("#{@template.path}.cache").should be_true
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should not cache templates if Project.settings.template.caching is false" do
|
92
|
-
Project.settings.template.caching = false
|
93
|
-
@engine.render(@template)
|
94
|
-
File.exist?("#{@template.path}.cache").should be_false
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "[ErubisClass]" do
|
101
|
-
include TemplateHelpers
|
102
|
-
before(:each) do
|
103
|
-
@engine = Rango::Templates::ErubisAdapter.new
|
104
|
-
@template = template("capture.html.erb")
|
105
|
-
Project.settings = settings(erubis: {pattern: "<% %>", custom_class: nil})
|
106
|
-
end
|
107
|
-
|
108
|
-
describe "#capture_erubis" do
|
109
|
-
it "should returns captured block" do
|
110
|
-
pending "Not implemented yet" do
|
111
|
-
body = @engine.render(@template)
|
112
|
-
raise body.inspect ####
|
113
|
-
body.should match("<li>1</li>")
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|