typo 5.2.98 → 5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/sidebar_controller.rb +15 -3
- data/app/helpers/sidebar_helper.rb +9 -4
- data/app/models/feedback.rb +10 -2
- data/app/models/page_cache.rb +5 -1
- data/app/views/admin/blacklist/_blacklist_patterns.html.erb +2 -0
- data/app/views/admin/categories/new.html.erb +1 -1
- data/app/views/admin/content/_form.html.erb +3 -3
- data/app/views/admin/content/_simple_editor.html.erb +2 -0
- data/app/views/admin/content/_visual_editor.html.erb +2 -0
- data/app/views/admin/pages/_form.html.erb +5 -5
- data/app/views/admin/pages/_simple_editor.html.erb +2 -0
- data/app/views/admin/pages/_visual_editor.html.erb +2 -0
- data/app/views/articles/_comment_box.html.erb +1 -1
- data/app/views/articles/_comment_failed.html.erb +1 -1
- data/app/views/articles/read.html.erb +1 -1
- data/config/environment.rb +3 -2
- data/lib/tasks/release.rake +3 -4
- data/lib/typo_version.rb +1 -1
- data/public/stylesheets/administration.css +37 -2
- data/public/stylesheets/administration_rtl.css +316 -437
- data/vendor/actionwebservice/CHANGELOG +320 -0
- data/vendor/actionwebservice/MIT-LICENSE +21 -0
- data/vendor/actionwebservice/README +381 -0
- data/vendor/actionwebservice/Rakefile +173 -0
- data/vendor/actionwebservice/TODO +32 -0
- data/vendor/actionwebservice/examples/googlesearch/README +143 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +108 -0
- data/vendor/actionwebservice/examples/googlesearch/delegated/search_controller.rb +7 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/google_search_api.rb +50 -0
- data/vendor/actionwebservice/examples/googlesearch/direct/search_controller.rb +58 -0
- data/vendor/actionwebservice/examples/metaWeblog/README +17 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +60 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +34 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
- data/vendor/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
- data/vendor/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
- data/vendor/actionwebservice/generators/web_service/USAGE +28 -0
- data/vendor/actionwebservice/generators/web_service/templates/api_definition.rb +5 -0
- data/vendor/actionwebservice/generators/web_service/templates/controller.rb +8 -0
- data/vendor/actionwebservice/generators/web_service/templates/functional_test.rb +19 -0
- data/vendor/actionwebservice/generators/web_service/web_service_generator.rb +29 -0
- data/vendor/actionwebservice/lib/action_web_service.rb +66 -0
- data/vendor/actionwebservice/lib/action_web_service/api.rb +297 -0
- data/vendor/actionwebservice/lib/action_web_service/base.rb +38 -0
- data/vendor/actionwebservice/lib/action_web_service/casting.rb +144 -0
- data/vendor/actionwebservice/lib/action_web_service/client.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/client/base.rb +28 -0
- data/vendor/actionwebservice/lib/action_web_service/client/soap_client.rb +113 -0
- data/vendor/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +58 -0
- data/vendor/actionwebservice/lib/action_web_service/container.rb +3 -0
- data/vendor/actionwebservice/lib/action_web_service/container/action_controller_container.rb +93 -0
- data/vendor/actionwebservice/lib/action_web_service/container/delegated_container.rb +86 -0
- data/vendor/actionwebservice/lib/action_web_service/container/direct_container.rb +69 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher.rb +2 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +207 -0
- data/vendor/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +379 -0
- data/vendor/actionwebservice/lib/action_web_service/invocation.rb +202 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol.rb +4 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/abstract.rb +112 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/discovery.rb +37 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +176 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
- data/vendor/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +122 -0
- data/vendor/actionwebservice/lib/action_web_service/scaffolding.rb +281 -0
- data/vendor/actionwebservice/lib/action_web_service/struct.rb +64 -0
- data/vendor/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +26 -0
- data/vendor/actionwebservice/lib/action_web_service/support/signature_types.rb +226 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
- data/vendor/actionwebservice/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
- data/vendor/actionwebservice/lib/action_web_service/test_invoke.rb +110 -0
- data/vendor/actionwebservice/lib/action_web_service/version.rb +9 -0
- data/vendor/actionwebservice/lib/actionwebservice.rb +1 -0
- data/vendor/actionwebservice/setup.rb +1379 -0
- data/vendor/actionwebservice/test/abstract_client.rb +183 -0
- data/vendor/actionwebservice/test/abstract_dispatcher.rb +547 -0
- data/vendor/actionwebservice/test/abstract_unit.rb +33 -0
- data/vendor/actionwebservice/test/api_test.rb +102 -0
- data/vendor/actionwebservice/test/apis/auto_load_api.rb +3 -0
- data/vendor/actionwebservice/test/apis/broken_auto_load_api.rb +2 -0
- data/vendor/actionwebservice/test/base_test.rb +42 -0
- data/vendor/actionwebservice/test/casting_test.rb +86 -0
- data/vendor/actionwebservice/test/client_soap_test.rb +155 -0
- data/vendor/actionwebservice/test/client_xmlrpc_test.rb +153 -0
- data/vendor/actionwebservice/test/container_test.rb +73 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_soap_test.rb +137 -0
- data/vendor/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
- data/vendor/actionwebservice/test/fixtures/db_definitions/mysql.sql +8 -0
- data/vendor/actionwebservice/test/fixtures/users.yml +12 -0
- data/vendor/actionwebservice/test/gencov +3 -0
- data/vendor/actionwebservice/test/invocation_test.rb +185 -0
- data/vendor/actionwebservice/test/run +6 -0
- data/vendor/actionwebservice/test/scaffolded_controller_test.rb +146 -0
- data/vendor/actionwebservice/test/struct_test.rb +52 -0
- data/vendor/actionwebservice/test/test_invoke_test.rb +112 -0
- data/vendor/gems/calendar_date_select-1.15/.specification +56 -0
- data/vendor/gems/calendar_date_select-1.15/History.txt +237 -0
- data/vendor/gems/calendar_date_select-1.15/MIT-LICENSE +20 -0
- data/vendor/gems/calendar_date_select-1.15/Manifest.txt +42 -0
- data/vendor/gems/calendar_date_select-1.15/Rakefile +31 -0
- data/vendor/gems/calendar_date_select-1.15/Readme.txt +16 -0
- data/vendor/gems/calendar_date_select-1.15/init.rb +1 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/functional/cds_test.html +334 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/prototype.js +4184 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/test.css +40 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unit/cds_helper_methods.html +46 -0
- data/vendor/gems/calendar_date_select-1.15/js_test/unittest.js +564 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select.rb +33 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/calendar_date_select.rb +116 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/form_helpers.rb +225 -0
- data/vendor/gems/calendar_date_select-1.15/lib/calendar_date_select/includes_helper.rb +29 -0
- data/vendor/gems/calendar_date_select-1.15/public/blank_iframe.html +2 -0
- data/vendor/gems/calendar_date_select-1.15/public/images/calendar_date_select/calendar.gif +0 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/calendar_date_select.js +443 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/de.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/vendor/gems/calendar_date_select-1.15/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/default.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/red.css +135 -0
- data/vendor/gems/calendar_date_select-1.15/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/calendar_date_select_spec.rb +14 -0
- data/vendor/gems/calendar_date_select-1.15/spec/calendar_date_select/form_helpers_spec.rb +166 -0
- data/vendor/gems/calendar_date_select-1.15/spec/spec_helper.rb +26 -0
- data/vendor/gems/coderay-0.8.260/.specification +2 -1
- data/vendor/gems/htmlentities-4.0.0/.specification +68 -0
- data/vendor/gems/htmlentities-4.0.0/COPYING.txt +21 -0
- data/vendor/gems/htmlentities-4.0.0/History.txt +47 -0
- data/vendor/gems/htmlentities-4.0.0/README.txt +44 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities.rb +165 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/html4.rb +257 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/legacy.rb +27 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/string.rb +26 -0
- data/vendor/gems/htmlentities-4.0.0/lib/htmlentities/xhtml1.rb +258 -0
- data/vendor/gems/htmlentities-4.0.0/test/entities_test.rb +206 -0
- data/vendor/gems/htmlentities-4.0.0/test/html4_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/legacy_test.rb +34 -0
- data/vendor/gems/htmlentities-4.0.0/test/roundtrip_test.rb +94 -0
- data/vendor/gems/htmlentities-4.0.0/test/string_test.rb +24 -0
- data/vendor/gems/htmlentities-4.0.0/test/test_all.rb +3 -0
- data/vendor/gems/htmlentities-4.0.0/test/xhtml1_test.rb +23 -0
- data/vendor/gems/json-1.1.3/.require_paths +4 -0
- data/vendor/gems/json-1.1.3/.specification +58 -0
- data/vendor/gems/json-1.1.3/CHANGES +93 -0
- data/vendor/gems/json-1.1.3/GPL +340 -0
- data/vendor/gems/json-1.1.3/README +78 -0
- data/vendor/gems/json-1.1.3/RUBY +58 -0
- data/vendor/gems/json-1.1.3/Rakefile +309 -0
- data/vendor/gems/json-1.1.3/TODO +1 -0
- data/vendor/gems/json-1.1.3/VERSION +1 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark.txt +133 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/gems/json-1.1.3/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/gems/json-1.1.3/bin/edit_json.rb +10 -0
- data/vendor/gems/json-1.1.3/bin/prettify_json.rb +76 -0
- data/vendor/gems/json-1.1.3/data/example.json +1 -0
- data/vendor/gems/json-1.1.3/data/index.html +38 -0
- data/vendor/gems/json-1.1.3/data/prototype.js +4184 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.c +875 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/generator.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/generator/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/Makefile +149 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.bundle +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.o +0 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/gems/json-1.1.3/ext/json/ext/parser/unicode.o +0 -0
- data/vendor/gems/json-1.1.3/install.rb +26 -0
- data/vendor/gems/json-1.1.3/lib/json.rb +235 -0
- data/vendor/gems/json-1.1.3/lib/json/Array.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/FalseClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Hash.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Key.xpm +73 -0
- data/vendor/gems/json-1.1.3/lib/json/NilClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/Numeric.xpm +28 -0
- data/vendor/gems/json-1.1.3/lib/json/String.xpm +96 -0
- data/vendor/gems/json-1.1.3/lib/json/TrueClass.xpm +21 -0
- data/vendor/gems/json-1.1.3/lib/json/add/core.rb +135 -0
- data/vendor/gems/json-1.1.3/lib/json/add/rails.rb +58 -0
- data/vendor/gems/json-1.1.3/lib/json/common.rb +354 -0
- data/vendor/gems/json-1.1.3/lib/json/editor.rb +1362 -0
- data/vendor/gems/json-1.1.3/lib/json/ext.rb +13 -0
- data/vendor/gems/json-1.1.3/lib/json/json.xpm +1499 -0
- data/vendor/gems/json-1.1.3/lib/json/pure.rb +75 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/generator.rb +394 -0
- data/vendor/gems/json-1.1.3/lib/json/pure/parser.rb +259 -0
- data/vendor/gems/json-1.1.3/lib/json/version.rb +9 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail1.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail10.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail11.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail12.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail13.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail14.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail18.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail19.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail20.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail21.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail22.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail23.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail24.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail25.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail27.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail28.json +2 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail3.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail4.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail5.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail6.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail7.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail8.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/fail9.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass1.json +56 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass15.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass16.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass17.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass2.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass26.json +1 -0
- data/vendor/gems/json-1.1.3/tests/fixtures/pass3.json +6 -0
- data/vendor/gems/json-1.1.3/tests/runner.rb +25 -0
- data/vendor/gems/json-1.1.3/tests/test_json.rb +293 -0
- data/vendor/gems/json-1.1.3/tests/test_json_addition.rb +161 -0
- data/vendor/gems/json-1.1.3/tests/test_json_fixtures.rb +30 -0
- data/vendor/gems/json-1.1.3/tests/test_json_generate.rb +100 -0
- data/vendor/gems/json-1.1.3/tests/test_json_rails.rb +118 -0
- data/vendor/gems/json-1.1.3/tests/test_json_unicode.rb +61 -0
- data/vendor/gems/json-1.1.3/tools/fuzz.rb +140 -0
- data/vendor/gems/json-1.1.3/tools/server.rb +62 -0
- data/vendor/plugins/localization/bin/make_language.rb +2 -2
- data/vendor/plugins/localization/lib/localization.rb +2 -2
- data/vendor/plugins/will_paginate/CHANGELOG.rdoc +110 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +107 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +82 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +146 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +260 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +170 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +37 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +383 -0
- data/vendor/plugins/will_paginate/test/boot.rb +21 -0
- data/vendor/plugins/will_paginate/test/collection_test.rb +143 -0
- data/vendor/plugins/will_paginate/test/console +8 -0
- data/vendor/plugins/will_paginate/test/database.yml +22 -0
- data/vendor/plugins/will_paginate/test/finder_test.rb +476 -0
- data/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/vendor/plugins/will_paginate/test/fixtures/developer.rb +14 -0
- data/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/vendor/plugins/will_paginate/test/fixtures/project.rb +15 -0
- data/vendor/plugins/will_paginate/test/fixtures/projects.yml +6 -0
- data/vendor/plugins/will_paginate/test/fixtures/replies.yml +29 -0
- data/vendor/plugins/will_paginate/test/fixtures/reply.rb +7 -0
- data/vendor/plugins/will_paginate/test/fixtures/schema.rb +38 -0
- data/vendor/plugins/will_paginate/test/fixtures/topic.rb +10 -0
- data/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/vendor/plugins/will_paginate/test/helper.rb +37 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_case.rb +36 -0
- data/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +73 -0
- data/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +11 -0
- data/vendor/plugins/will_paginate/test/lib/view_test_process.rb +165 -0
- data/vendor/plugins/will_paginate/test/tasks.rake +59 -0
- data/vendor/plugins/will_paginate/test/view_test.rb +363 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +22 -0
- data/vendor/plugins/xml_sidebar/lib/xml_sidebar.rb +1 -1
- metadata +349 -16
- data/migrate.txt +0 -142
@@ -0,0 +1,293 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'json'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
class TC_JSON < Test::Unit::TestCase
|
8
|
+
include JSON
|
9
|
+
|
10
|
+
def setup
|
11
|
+
$KCODE = 'UTF8'
|
12
|
+
@ary = [1, "foo", 3.14, 4711.0, 2.718, nil, [1,-2,3], false, true].map do
|
13
|
+
|x| [x]
|
14
|
+
end
|
15
|
+
@ary_to_parse = ["1", '"foo"', "3.14", "4711.0", "2.718", "null",
|
16
|
+
"[1,-2,3]", "false", "true"].map do
|
17
|
+
|x| "[#{x}]"
|
18
|
+
end
|
19
|
+
@hash = {
|
20
|
+
'a' => 2,
|
21
|
+
'b' => 3.141,
|
22
|
+
'c' => 'c',
|
23
|
+
'd' => [ 1, "b", 3.14 ],
|
24
|
+
'e' => { 'foo' => 'bar' },
|
25
|
+
'g' => "\"\0\037",
|
26
|
+
'h' => 1000.0,
|
27
|
+
'i' => 0.001
|
28
|
+
}
|
29
|
+
@json = '{"a":2,"b":3.141,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},' +
|
30
|
+
'"g":"\\"\\u0000\\u001f","h":1.0E3,"i":1.0E-3}'
|
31
|
+
end
|
32
|
+
suite << TC_JSON.suite
|
33
|
+
|
34
|
+
def test_construction
|
35
|
+
parser = JSON::Parser.new('test')
|
36
|
+
assert_equal 'test', parser.source
|
37
|
+
end
|
38
|
+
|
39
|
+
def assert_equal_float(expected, is)
|
40
|
+
assert_in_delta(expected.first, is.first, 1e-2)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_parse_simple_arrays
|
44
|
+
assert_equal([], parse('[]'))
|
45
|
+
assert_equal([], parse(' [ ] '))
|
46
|
+
assert_equal([nil], parse('[null]'))
|
47
|
+
assert_equal([false], parse('[false]'))
|
48
|
+
assert_equal([true], parse('[true]'))
|
49
|
+
assert_equal([-23], parse('[-23]'))
|
50
|
+
assert_equal([23], parse('[23]'))
|
51
|
+
assert_equal([0.23], parse('[0.23]'))
|
52
|
+
assert_equal([0.0], parse('[0e0]'))
|
53
|
+
assert_raises(JSON::ParserError) { parse('[+23.2]') }
|
54
|
+
assert_raises(JSON::ParserError) { parse('[+23]') }
|
55
|
+
assert_raises(JSON::ParserError) { parse('[.23]') }
|
56
|
+
assert_raises(JSON::ParserError) { parse('[023]') }
|
57
|
+
assert_equal_float [3.141], parse('[3.141]')
|
58
|
+
assert_equal_float [-3.141], parse('[-3.141]')
|
59
|
+
assert_equal_float [3.141], parse('[3141e-3]')
|
60
|
+
assert_equal_float [3.141], parse('[3141.1e-3]')
|
61
|
+
assert_equal_float [3.141], parse('[3141E-3]')
|
62
|
+
assert_equal_float [3.141], parse('[3141.0E-3]')
|
63
|
+
assert_equal_float [-3.141], parse('[-3141.0e-3]')
|
64
|
+
assert_equal_float [-3.141], parse('[-3141e-3]')
|
65
|
+
assert_raises(ParserError) { parse('[NaN]') }
|
66
|
+
assert parse('[NaN]', :allow_nan => true).first.nan?
|
67
|
+
assert_raises(ParserError) { parse('[Infinity]') }
|
68
|
+
assert_equal [1.0/0], parse('[Infinity]', :allow_nan => true)
|
69
|
+
assert_raises(ParserError) { parse('[-Infinity]') }
|
70
|
+
assert_equal [-1.0/0], parse('[-Infinity]', :allow_nan => true)
|
71
|
+
assert_equal([""], parse('[""]'))
|
72
|
+
assert_equal(["foobar"], parse('["foobar"]'))
|
73
|
+
assert_equal([{}], parse('[{}]'))
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_parse_simple_objects
|
77
|
+
assert_equal({}, parse('{}'))
|
78
|
+
assert_equal({}, parse(' { } '))
|
79
|
+
assert_equal({ "a" => nil }, parse('{ "a" : null}'))
|
80
|
+
assert_equal({ "a" => nil }, parse('{"a":null}'))
|
81
|
+
assert_equal({ "a" => false }, parse('{ "a" : false } '))
|
82
|
+
assert_equal({ "a" => false }, parse('{"a":false}'))
|
83
|
+
assert_raises(JSON::ParserError) { parse('{false}') }
|
84
|
+
assert_equal({ "a" => true }, parse('{"a":true}'))
|
85
|
+
assert_equal({ "a" => true }, parse(' { "a" : true } '))
|
86
|
+
assert_equal({ "a" => -23 }, parse(' { "a" : -23 } '))
|
87
|
+
assert_equal({ "a" => -23 }, parse(' { "a" : -23 } '))
|
88
|
+
assert_equal({ "a" => 23 }, parse('{"a":23 } '))
|
89
|
+
assert_equal({ "a" => 23 }, parse(' { "a" : 23 } '))
|
90
|
+
assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } '))
|
91
|
+
assert_equal({ "a" => 0.23 }, parse(' { "a" : 0.23 } '))
|
92
|
+
end
|
93
|
+
|
94
|
+
begin
|
95
|
+
require 'permutation'
|
96
|
+
def test_parse_more_complex_arrays
|
97
|
+
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
98
|
+
perms = Permutation.for a
|
99
|
+
perms.each do |perm|
|
100
|
+
orig_ary = perm.project
|
101
|
+
json = pretty_generate(orig_ary)
|
102
|
+
assert_equal orig_ary, parse(json)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_parse_complex_objects
|
107
|
+
a = [ nil, false, true, "foßbar", [ "n€st€d", true ], { "nested" => true, "n€ßt€ð2" => {} }]
|
108
|
+
perms = Permutation.for a
|
109
|
+
perms.each do |perm|
|
110
|
+
s = "a"
|
111
|
+
orig_obj = perm.project.inject({}) { |h, x| h[s.dup] = x; s = s.succ; h }
|
112
|
+
json = pretty_generate(orig_obj)
|
113
|
+
assert_equal orig_obj, parse(json)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
rescue LoadError
|
117
|
+
warn "Skipping permutation tests."
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_parse_arrays
|
121
|
+
assert_equal([1,2,3], parse('[1,2,3]'))
|
122
|
+
assert_equal([1.2,2,3], parse('[1.2,2,3]'))
|
123
|
+
assert_equal([[],[[],[]]], parse('[[],[[],[]]]'))
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_parse_values
|
127
|
+
assert_equal([""], parse('[""]'))
|
128
|
+
assert_equal(["\\"], parse('["\\\\"]'))
|
129
|
+
assert_equal(['"'], parse('["\""]'))
|
130
|
+
assert_equal(['\\"\\'], parse('["\\\\\\"\\\\"]'))
|
131
|
+
assert_equal(["\"\b\n\r\t\0\037"],
|
132
|
+
parse('["\"\b\n\r\t\u0000\u001f"]'))
|
133
|
+
for i in 0 ... @ary.size
|
134
|
+
assert_equal(@ary[i], parse(@ary_to_parse[i]))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_parse_array
|
139
|
+
assert_equal([], parse('[]'))
|
140
|
+
assert_equal([], parse(' [ ] '))
|
141
|
+
assert_equal([1], parse('[1]'))
|
142
|
+
assert_equal([1], parse(' [ 1 ] '))
|
143
|
+
assert_equal(@ary,
|
144
|
+
parse('[[1],["foo"],[3.14],[47.11e+2],[2718.0E-3],[null],[[1,-2,3]]'\
|
145
|
+
',[false],[true]]'))
|
146
|
+
assert_equal(@ary, parse(%Q{ [ [1] , ["foo"] , [3.14] \t , [47.11e+2]
|
147
|
+
, [2718.0E-3 ],\r[ null] , [[1, -2, 3 ]], [false ],[ true]\n ] }))
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_parse_object
|
151
|
+
assert_equal({}, parse('{}'))
|
152
|
+
assert_equal({}, parse(' { } '))
|
153
|
+
assert_equal({'foo'=>'bar'}, parse('{"foo":"bar"}'))
|
154
|
+
assert_equal({'foo'=>'bar'}, parse(' { "foo" : "bar" } '))
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_parser_reset
|
158
|
+
parser = Parser.new(@json)
|
159
|
+
assert_equal(@hash, parser.parse)
|
160
|
+
assert_equal(@hash, parser.parse)
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_comments
|
164
|
+
json = <<EOT
|
165
|
+
{
|
166
|
+
"key1":"value1", // eol comment
|
167
|
+
"key2":"value2" /* multi line
|
168
|
+
* comment */,
|
169
|
+
"key3":"value3" /* multi line
|
170
|
+
// nested eol comment
|
171
|
+
* comment */
|
172
|
+
}
|
173
|
+
EOT
|
174
|
+
assert_equal(
|
175
|
+
{ "key1" => "value1", "key2" => "value2", "key3" => "value3" },
|
176
|
+
parse(json))
|
177
|
+
json = <<EOT
|
178
|
+
{
|
179
|
+
"key1":"value1" /* multi line
|
180
|
+
// nested eol comment
|
181
|
+
/* illegal nested multi line comment */
|
182
|
+
* comment */
|
183
|
+
}
|
184
|
+
EOT
|
185
|
+
assert_raises(ParserError) { parse(json) }
|
186
|
+
json = <<EOT
|
187
|
+
{
|
188
|
+
"key1":"value1" /* multi line
|
189
|
+
// nested eol comment
|
190
|
+
closed multi comment */
|
191
|
+
and again, throw an Error */
|
192
|
+
}
|
193
|
+
EOT
|
194
|
+
assert_raises(ParserError) { parse(json) }
|
195
|
+
json = <<EOT
|
196
|
+
{
|
197
|
+
"key1":"value1" /*/*/
|
198
|
+
}
|
199
|
+
EOT
|
200
|
+
assert_equal({ "key1" => "value1" }, parse(json))
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_backslash
|
204
|
+
data = [ '\\.(?i:gif|jpe?g|png)$' ]
|
205
|
+
json = '["\\\\.(?i:gif|jpe?g|png)$"]'
|
206
|
+
assert_equal json, JSON.unparse(data)
|
207
|
+
assert_equal data, JSON.parse(json)
|
208
|
+
#
|
209
|
+
data = [ '\\"' ]
|
210
|
+
json = '["\\\\\""]'
|
211
|
+
assert_equal json, JSON.unparse(data)
|
212
|
+
assert_equal data, JSON.parse(json)
|
213
|
+
#
|
214
|
+
json = '["\/"]'
|
215
|
+
data = JSON.parse(json)
|
216
|
+
assert_equal ['/'], data
|
217
|
+
assert_equal json, JSON.unparse(data)
|
218
|
+
#
|
219
|
+
json = '["\""]'
|
220
|
+
data = JSON.parse(json)
|
221
|
+
assert_equal ['"'], data
|
222
|
+
assert_equal json, JSON.unparse(data)
|
223
|
+
json = '["\\\'"]'
|
224
|
+
data = JSON.parse(json)
|
225
|
+
assert_equal ["'"], data
|
226
|
+
assert_equal '["\'"]', JSON.unparse(data)
|
227
|
+
end
|
228
|
+
|
229
|
+
def test_wrong_inputs
|
230
|
+
assert_raises(ParserError) { JSON.parse('"foo"') }
|
231
|
+
assert_raises(ParserError) { JSON.parse('123') }
|
232
|
+
assert_raises(ParserError) { JSON.parse('[] bla') }
|
233
|
+
assert_raises(ParserError) { JSON.parse('[] 1') }
|
234
|
+
assert_raises(ParserError) { JSON.parse('[] []') }
|
235
|
+
assert_raises(ParserError) { JSON.parse('[] {}') }
|
236
|
+
assert_raises(ParserError) { JSON.parse('{} []') }
|
237
|
+
assert_raises(ParserError) { JSON.parse('{} {}') }
|
238
|
+
assert_raises(ParserError) { JSON.parse('[NULL]') }
|
239
|
+
assert_raises(ParserError) { JSON.parse('[FALSE]') }
|
240
|
+
assert_raises(ParserError) { JSON.parse('[TRUE]') }
|
241
|
+
assert_raises(ParserError) { JSON.parse('[07] ') }
|
242
|
+
assert_raises(ParserError) { JSON.parse('[0a]') }
|
243
|
+
assert_raises(ParserError) { JSON.parse('[1.]') }
|
244
|
+
assert_raises(ParserError) { JSON.parse(' ') }
|
245
|
+
end
|
246
|
+
|
247
|
+
def test_nesting
|
248
|
+
assert_raises(JSON::NestingError) { JSON.parse '[[]]', :max_nesting => 1 }
|
249
|
+
assert_raises(JSON::NestingError) { JSON.parser.new('[[]]', :max_nesting => 1).parse }
|
250
|
+
assert_equal [[]], JSON.parse('[[]]', :max_nesting => 2)
|
251
|
+
too_deep = '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]'
|
252
|
+
too_deep_ary = eval too_deep
|
253
|
+
assert_raises(JSON::NestingError) { JSON.parse too_deep }
|
254
|
+
assert_raises(JSON::NestingError) { JSON.parser.new(too_deep).parse }
|
255
|
+
assert_raises(JSON::NestingError) { JSON.parse too_deep, :max_nesting => 19 }
|
256
|
+
ok = JSON.parse too_deep, :max_nesting => 20
|
257
|
+
assert_equal too_deep_ary, ok
|
258
|
+
ok = JSON.parse too_deep, :max_nesting => nil
|
259
|
+
assert_equal too_deep_ary, ok
|
260
|
+
ok = JSON.parse too_deep, :max_nesting => false
|
261
|
+
assert_equal too_deep_ary, ok
|
262
|
+
ok = JSON.parse too_deep, :max_nesting => 0
|
263
|
+
assert_equal too_deep_ary, ok
|
264
|
+
assert_raises(JSON::NestingError) { JSON.generate [[]], :max_nesting => 1 }
|
265
|
+
assert_equal '[[]]', JSON.generate([[]], :max_nesting => 2)
|
266
|
+
assert_raises(JSON::NestingError) { JSON.generate too_deep_ary }
|
267
|
+
assert_raises(JSON::NestingError) { JSON.generate too_deep_ary, :max_nesting => 19 }
|
268
|
+
ok = JSON.generate too_deep_ary, :max_nesting => 20
|
269
|
+
assert_equal too_deep, ok
|
270
|
+
ok = JSON.generate too_deep_ary, :max_nesting => nil
|
271
|
+
assert_equal too_deep, ok
|
272
|
+
ok = JSON.generate too_deep_ary, :max_nesting => false
|
273
|
+
assert_equal too_deep, ok
|
274
|
+
ok = JSON.generate too_deep_ary, :max_nesting => 0
|
275
|
+
assert_equal too_deep, ok
|
276
|
+
end
|
277
|
+
|
278
|
+
def test_load_dump
|
279
|
+
too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
|
280
|
+
assert_equal too_deep, JSON.dump(eval(too_deep))
|
281
|
+
assert_kind_of String, Marshal.dump(eval(too_deep))
|
282
|
+
assert_raises(ArgumentError) { JSON.dump(eval(too_deep), 19) }
|
283
|
+
assert_raises(ArgumentError) { Marshal.dump(eval(too_deep), 19) }
|
284
|
+
assert_equal too_deep, JSON.dump(eval(too_deep), 20)
|
285
|
+
assert_kind_of String, Marshal.dump(eval(too_deep), 20)
|
286
|
+
output = StringIO.new
|
287
|
+
JSON.dump(eval(too_deep), output)
|
288
|
+
assert_equal too_deep, output.string
|
289
|
+
output = StringIO.new
|
290
|
+
JSON.dump(eval(too_deep), output, 20)
|
291
|
+
assert_equal too_deep, output.string
|
292
|
+
end
|
293
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'json/add/core'
|
5
|
+
require 'date'
|
6
|
+
|
7
|
+
class TC_JSONAddition < Test::Unit::TestCase
|
8
|
+
include JSON
|
9
|
+
|
10
|
+
class A
|
11
|
+
def initialize(a)
|
12
|
+
@a = a
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :a
|
16
|
+
|
17
|
+
def ==(other)
|
18
|
+
a == other.a
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.json_create(object)
|
22
|
+
new(*object['args'])
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json(*args)
|
26
|
+
{
|
27
|
+
'json_class' => self.class.name,
|
28
|
+
'args' => [ @a ],
|
29
|
+
}.to_json(*args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class B
|
34
|
+
def self.json_creatable?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_json(*args)
|
39
|
+
{
|
40
|
+
'json_class' => self.class.name,
|
41
|
+
}.to_json(*args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class C
|
46
|
+
def self.json_creatable?
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_json(*args)
|
51
|
+
{
|
52
|
+
'json_class' => 'TC_JSONAddition::Nix',
|
53
|
+
}.to_json(*args)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def setup
|
58
|
+
$KCODE = 'UTF8'
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_extended_json
|
62
|
+
a = A.new(666)
|
63
|
+
assert A.json_creatable?
|
64
|
+
json = generate(a)
|
65
|
+
a_again = JSON.parse(json)
|
66
|
+
assert_kind_of a.class, a_again
|
67
|
+
assert_equal a, a_again
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_extended_json_disabled
|
71
|
+
a = A.new(666)
|
72
|
+
assert A.json_creatable?
|
73
|
+
json = generate(a)
|
74
|
+
a_again = JSON.parse(json, :create_additions => true)
|
75
|
+
assert_kind_of a.class, a_again
|
76
|
+
assert_equal a, a_again
|
77
|
+
a_hash = JSON.parse(json, :create_additions => false)
|
78
|
+
assert_kind_of Hash, a_hash
|
79
|
+
assert_equal(
|
80
|
+
{"args"=>[666], "json_class"=>"TC_JSONAddition::A"}.sort_by { |k,| k },
|
81
|
+
a_hash.sort_by { |k,| k }
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_extended_json_fail1
|
86
|
+
b = B.new
|
87
|
+
assert !B.json_creatable?
|
88
|
+
json = generate(b)
|
89
|
+
assert_equal({ "json_class"=>"TC_JSONAddition::B" }, JSON.parse(json))
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_extended_json_fail2
|
93
|
+
c = C.new
|
94
|
+
assert !C.json_creatable?
|
95
|
+
json = generate(c)
|
96
|
+
assert_raises(ArgumentError) { JSON.parse(json) }
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_raw_strings
|
100
|
+
raw = ''
|
101
|
+
raw_array = []
|
102
|
+
for i in 0..255
|
103
|
+
raw << i
|
104
|
+
raw_array << i
|
105
|
+
end
|
106
|
+
json = raw.to_json_raw
|
107
|
+
json_raw_object = raw.to_json_raw_object
|
108
|
+
hash = { 'json_class' => 'String', 'raw'=> raw_array }
|
109
|
+
assert_equal hash, json_raw_object
|
110
|
+
json_raw = <<EOT.chomp
|
111
|
+
{\"json_class\":\"String\",\"raw\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]}
|
112
|
+
EOT
|
113
|
+
# "
|
114
|
+
assert_equal json_raw, json
|
115
|
+
raw_again = JSON.parse(json)
|
116
|
+
assert_equal raw, raw_again
|
117
|
+
end
|
118
|
+
|
119
|
+
MyJsonStruct = Struct.new 'MyJsonStruct', :foo, :bar
|
120
|
+
|
121
|
+
def test_core
|
122
|
+
t = Time.now
|
123
|
+
assert_equal t, JSON(JSON(t))
|
124
|
+
d = Date.today
|
125
|
+
assert_equal d, JSON(JSON(d))
|
126
|
+
d = DateTime.civil(2007, 6, 14, 14, 57, 10, Rational(1, 12), 2299161)
|
127
|
+
assert_equal d, JSON(JSON(d))
|
128
|
+
assert_equal 1..10, JSON(JSON(1..10))
|
129
|
+
assert_equal 1...10, JSON(JSON(1...10))
|
130
|
+
assert_equal "a".."c", JSON(JSON("a".."c"))
|
131
|
+
assert_equal "a"..."c", JSON(JSON("a"..."c"))
|
132
|
+
s = MyJsonStruct.new 4711, 'foot'
|
133
|
+
assert_equal s, JSON(JSON(s))
|
134
|
+
struct = Struct.new :foo, :bar
|
135
|
+
s = struct.new 4711, 'foot'
|
136
|
+
assert_raises(JSONError) { JSON(s) }
|
137
|
+
begin
|
138
|
+
raise TypeError, "test me"
|
139
|
+
rescue TypeError => e
|
140
|
+
e_json = JSON.generate e
|
141
|
+
e_again = JSON e_json
|
142
|
+
assert_kind_of TypeError, e_again
|
143
|
+
assert_equal e.message, e_again.message
|
144
|
+
assert_equal e.backtrace, e_again.backtrace
|
145
|
+
end
|
146
|
+
assert_equal(/foo/, JSON(JSON(/foo/)))
|
147
|
+
assert_equal(/foo/i, JSON(JSON(/foo/i)))
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_utc_datetime
|
151
|
+
now = Time.now
|
152
|
+
d = DateTime.parse(now.to_s) # usual case
|
153
|
+
assert d, JSON.parse(d.to_json)
|
154
|
+
d = DateTime.parse(now.utc.to_s) # of = 0
|
155
|
+
assert d, JSON.parse(d.to_json)
|
156
|
+
d = DateTime.civil(2008, 6, 17, 11, 48, 32, 1) # of = 1 / 12 => 1/12
|
157
|
+
assert d, JSON.parse(d.to_json)
|
158
|
+
d = DateTime.civil(2008, 6, 17, 11, 48, 32, 12) # of = 12 / 12 => 12
|
159
|
+
assert d, JSON.parse(d.to_json)
|
160
|
+
end
|
161
|
+
end
|