spontaneous 0.2.0.alpha2 → 0.2.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -40
- data/Rakefile +29 -41
- data/Readme.markdown +21 -8
- data/application/css/add_alias_dialogue.css.scss +79 -0
- data/application/css/{v2.scss → core.css.scss} +537 -550
- data/application/css/{definitions.scss → definitions.css.scss} +121 -33
- data/application/css/dialogue.css.scss +409 -0
- data/application/css/{editing.scss → editing.css.scss} +25 -262
- data/application/css/font.css.scss +8 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_222222_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_228ef1_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ef8c08_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffd27a_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffffff_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/ui-lightness.css.scss +565 -0
- data/application/css/{login.scss → login.css.scss} +4 -4
- data/application/css/meta.css.scss +331 -0
- data/application/css/{popover.scss → popover.css.scss} +9 -8
- data/application/css/{schema_error.scss → schema_error.css.scss} +4 -4
- data/application/css/spontaneous.css +5 -0
- data/application/css/unsupported.css.scss +42 -0
- data/application/js/add_alias_dialogue.js +72 -10
- data/application/js/ajax.js +50 -16
- data/application/js/compatibility.js +19 -15
- data/application/js/content.js +39 -36
- data/application/js/content_area.js +53 -5
- data/application/js/dialogue.js +17 -0
- data/application/js/dom.js +1 -1
- data/application/js/edit_panel.js +23 -8
- data/application/js/extensions.js +7 -2
- data/application/js/field_preview.js +2 -1
- data/application/js/field_types/date_field.js +11 -8
- data/application/js/field_types/file_field.js +188 -9
- data/application/js/field_types/image_field.js +46 -29
- data/application/js/field_types/markdown_field.js +57 -14
- data/application/js/field_types/select_field.js +72 -0
- data/application/js/field_types/string_field.js +8 -0
- data/application/js/field_types/webvideo_field.js +8 -0
- data/application/js/init.js +1 -7
- data/application/js/location.js +41 -13
- data/application/js/login.js +3 -0
- data/application/js/meta_view/user_admin.js +543 -0
- data/application/js/meta_view.js +1 -0
- data/application/js/metadata.js +20 -0
- data/application/js/page.js +17 -3
- data/application/js/page_browser.js +40 -30
- data/application/js/page_entry.js +4 -0
- data/application/js/panel/root_menu.js +66 -0
- data/application/js/popover.js +2 -2
- data/application/js/preview.js +1 -1
- data/application/js/publish.js +138 -30
- data/application/js/services.js +43 -0
- data/application/js/sharded_upload.js +2 -2
- data/application/js/spontaneous.js +64 -5
- data/application/js/state.js +20 -9
- data/application/js/top_bar.js +273 -150
- data/application/js/types.js +20 -15
- data/application/js/upload.js +1 -2
- data/application/js/user.js +18 -4
- data/application/js/vendor/date.js +104 -0
- data/application/js/vendor/jquery-ui-1.8.18.custom.min.js +356 -0
- data/application/js/views/box_view.js +15 -8
- data/application/js/views/page_piece_view.js +11 -8
- data/application/js/views/page_view.js +21 -3
- data/application/js/views/piece_view.js +19 -10
- data/application/js/views.js +3 -0
- data/application/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png +0 -0
- data/application/static/dot-texture-9eea29e4ac7ad9a772285252078ec127.png +0 -0
- data/application/static/editing-textarea-resize-s-b5af62365eb7e19ea4beccf7242d508e.png +0 -0
- data/application/static/editing-texture-1-42b06a3439752490988f30f2a06d5e7c.png +0 -0
- data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
- data/application/static/loop_alt1-white-7894b458528e92216196cae26b4c2c96.svg +12 -0
- data/application/static/spontaneous-states-e91ec89db525c62da0105b97cdd781ce.png +0 -0
- data/application/views/index.erb +2 -2
- data/application/views/login.erb +4 -8
- data/application/views/schema_modification_error.html.erb +1 -4
- data/application/views/unsupported.erb +9 -7
- data/bin/spot +1 -1
- data/db/migrations/20110209152710_users_and_groups.rb +10 -10
- data/db/migrations/20120305112647_site_modification_time.rb +11 -0
- data/db/migrations/20120418153903_add_ownership_of_content.rb +14 -0
- data/db/migrations/20120423175416_add_pending_modifications.rb +21 -0
- data/db/migrations/20120525164947_add_field_versions.rb +27 -0
- data/lib/sequel/plugins/scoped_table_name.rb +10 -1
- data/lib/spontaneous/asset/file.rb +25 -0
- data/lib/spontaneous/asset/source.rb +28 -0
- data/lib/spontaneous/asset.rb +75 -0
- data/lib/spontaneous/box.rb +6 -4
- data/lib/spontaneous/capistrano/deploy.rb +47 -0
- data/lib/spontaneous/capistrano/sync.rb +81 -0
- data/lib/spontaneous/capistrano.rb +13 -0
- data/lib/spontaneous/change.rb +60 -68
- data/lib/spontaneous/cli/assets.rb +29 -0
- data/lib/spontaneous/cli/base.rb +0 -48
- data/lib/spontaneous/cli/console.rb +1 -1
- data/lib/spontaneous/cli/server.rb +6 -4
- data/lib/spontaneous/cli/site.rb +28 -17
- data/lib/spontaneous/cli/user.rb +107 -0
- data/lib/spontaneous/cli.rb +100 -4
- data/lib/spontaneous/collections/entry_set.rb +2 -2
- data/lib/spontaneous/collections/field_set.rb +48 -22
- data/lib/spontaneous/collections/prototype_set.rb +20 -13
- data/lib/spontaneous/constants.rb +3 -0
- data/lib/spontaneous/content.rb +22 -5
- data/lib/spontaneous/errors.rb +3 -3
- data/lib/spontaneous/extensions/array.rb +12 -0
- data/lib/spontaneous/extensions/enumerable.rb +30 -0
- data/lib/spontaneous/extensions/nil.rb +3 -1
- data/lib/spontaneous/extensions/string.rb +16 -0
- data/lib/spontaneous/field_types/date_field.rb +45 -2
- data/lib/spontaneous/field_types/field.rb +42 -9
- data/lib/spontaneous/field_types/file_field.rb +68 -0
- data/lib/spontaneous/field_types/image_field.rb +63 -0
- data/lib/spontaneous/field_types/select_field.rb +109 -0
- data/lib/spontaneous/field_types/string_field.rb +6 -1
- data/lib/spontaneous/field_types/webvideo_field.rb +85 -27
- data/lib/spontaneous/field_types.rb +1 -1
- data/lib/spontaneous/field_version.rb +8 -0
- data/lib/spontaneous/generators/page.rb +1 -1
- data/lib/spontaneous/generators/site/Capfile.tt +1 -4
- data/lib/spontaneous/generators/site/Gemfile.tt +13 -6
- data/lib/spontaneous/generators/site/config/deploy.rb.tt +28 -0
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +7 -2
- data/lib/spontaneous/generators/site.rb +1 -0
- data/lib/spontaneous/json.rb +34 -11
- data/lib/spontaneous/layout.rb +22 -0
- data/lib/spontaneous/media/file.rb +4 -0
- data/lib/spontaneous/output/assets/compression.rb +58 -0
- data/lib/spontaneous/output/assets.rb +32 -0
- data/lib/spontaneous/output/context.rb +179 -0
- data/lib/spontaneous/output/format/html.rb +5 -0
- data/lib/spontaneous/output/format/plain.rb +5 -0
- data/lib/spontaneous/output/format.rb +180 -0
- data/lib/spontaneous/output/helpers/classes_helper.rb +18 -0
- data/lib/spontaneous/{render/helpers/html_helper.rb → output/helpers/conditional_comment_helper.rb} +3 -12
- data/lib/spontaneous/output/helpers/script_helper.rb +73 -0
- data/lib/spontaneous/output/helpers/stylesheet_helper.rb +61 -0
- data/lib/spontaneous/output/helpers.rb +28 -0
- data/lib/spontaneous/output/template/engine.rb +59 -0
- data/lib/spontaneous/output/template/renderer.rb +153 -0
- data/lib/spontaneous/output/template.rb +21 -0
- data/lib/spontaneous/output.rb +163 -0
- data/lib/spontaneous/page.rb +2 -1
- data/lib/spontaneous/paths.rb +6 -1
- data/lib/spontaneous/permissions/access_key.rb +5 -5
- data/lib/spontaneous/permissions/user.rb +81 -35
- data/lib/spontaneous/permissions/user_level.rb +26 -22
- data/lib/spontaneous/plugins/aliases.rb +76 -12
- data/lib/spontaneous/plugins/allowed_types.rb +60 -18
- data/lib/spontaneous/plugins/application/paths.rb +0 -28
- data/lib/spontaneous/plugins/application/system.rb +35 -0
- data/lib/spontaneous/plugins/boxes.rb +4 -0
- data/lib/spontaneous/plugins/content_groups.rb +16 -0
- data/lib/spontaneous/plugins/entries.rb +50 -30
- data/lib/spontaneous/plugins/fields.rb +15 -0
- data/lib/spontaneous/plugins/layouts.rb +8 -2
- data/lib/spontaneous/plugins/modifications.rb +228 -0
- data/lib/spontaneous/plugins/page/formats.rb +67 -42
- data/lib/spontaneous/plugins/page/request.rb +10 -0
- data/lib/spontaneous/plugins/page/site_timestamps.rb +28 -0
- data/lib/spontaneous/plugins/paths.rb +15 -3
- data/lib/spontaneous/plugins/publishing.rb +124 -45
- data/lib/spontaneous/plugins/render.rb +13 -8
- data/lib/spontaneous/plugins/schema_hierarchy.rb +18 -6
- data/lib/spontaneous/plugins/site/helpers.rb +53 -0
- data/lib/spontaneous/plugins/site/hooks.rb +50 -0
- data/lib/spontaneous/plugins/site/map.rb +1 -1
- data/lib/spontaneous/plugins/site/paths.rb +13 -0
- data/lib/spontaneous/plugins/site/publishing.rb +6 -2
- data/lib/spontaneous/plugins/site/{revisions.rb → state.rb} +5 -1
- data/lib/spontaneous/plugins/site/storage.rb +4 -0
- data/lib/spontaneous/plugins/site/url.rb +15 -0
- data/lib/spontaneous/plugins/site_map.rb +13 -3
- data/lib/spontaneous/plugins/styles.rb +5 -1
- data/lib/spontaneous/plugins/visibility.rb +39 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +4 -0
- data/lib/spontaneous/prototypes/field_prototype.rb +15 -10
- data/lib/spontaneous/publishing/event_client.rb +46 -0
- data/lib/spontaneous/publishing/immediate.rb +81 -44
- data/lib/spontaneous/publishing/simultaneous.rb +23 -6
- data/lib/spontaneous/publishing.rb +4 -3
- data/lib/spontaneous/rack/around_back.rb +1 -5
- data/lib/spontaneous/rack/around_front.rb +4 -4
- data/lib/spontaneous/rack/around_preview.rb +4 -3
- data/lib/spontaneous/rack/assets.rb +81 -54
- data/lib/spontaneous/rack/authentication.rb +0 -1
- data/lib/spontaneous/rack/back.rb +160 -72
- data/lib/spontaneous/rack/cookie_authentication.rb +2 -2
- data/lib/spontaneous/rack/css.rb +18 -15
- data/lib/spontaneous/rack/event_source.rb +9 -21
- data/lib/spontaneous/rack/fiber_pool.rb +26 -0
- data/lib/spontaneous/rack/front.rb +12 -4
- data/lib/spontaneous/rack/helpers.rb +35 -13
- data/lib/spontaneous/rack/js.rb +41 -0
- data/lib/spontaneous/rack/public.rb +34 -44
- data/lib/spontaneous/rack/sse.rb +18 -0
- data/lib/spontaneous/rack/static.rb +3 -0
- data/lib/spontaneous/rack/user_admin.rb +100 -0
- data/lib/spontaneous/rack/user_helpers.rb +1 -1
- data/lib/spontaneous/rack.rb +6 -2
- data/lib/spontaneous/schema.rb +31 -4
- data/lib/spontaneous/search/index.rb +19 -3
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/sequel.rb +17 -0
- data/lib/spontaneous/site.rb +11 -4
- data/lib/spontaneous/state.rb +11 -0
- data/lib/spontaneous/storage/cloud.rb +4 -0
- data/lib/spontaneous/storage/local.rb +11 -0
- data/lib/spontaneous/style.rb +2 -2
- data/lib/spontaneous/tasks/database.rake +21 -22
- data/lib/spontaneous/utils/database/mysql_dumper.rb +4 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +78 -0
- data/lib/spontaneous/utils/database.rb +6 -3
- data/lib/spontaneous/utils/smart_quotes.rb +499 -0
- data/lib/spontaneous/utils/smush_it.rb +66 -0
- data/lib/spontaneous/utils.rb +3 -1
- data/lib/spontaneous/version.rb +2 -2
- data/lib/spontaneous.rb +25 -29
- data/spontaneous.gemspec +186 -106
- data/test/experimental/test_features.rb +1 -1
- data/test/fixtures/asset_pipeline/application/css/basic.css.scss +4 -0
- data/test/fixtures/asset_pipeline/application/css/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/css/spontaneous.css +7 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/library.css.scss +1 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/js/basic.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/login.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/require.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/spontaneous.js +5 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/library.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/vendor/jquery.js +1 -0
- data/test/fixtures/asset_pipeline/application/static/dot-texture.png +0 -0
- data/test/fixtures/asset_pipeline/application/static/subdir/px.gif +0 -0
- data/test/fixtures/assets/public1/css/a.scss +1 -0
- data/test/fixtures/assets/public1/js/a.js +1 -0
- data/test/fixtures/assets/public1/js/m.coffee +1 -0
- data/test/fixtures/assets/public2/css/b.scss +1 -0
- data/test/fixtures/assets/public2/css/c.css +1 -0
- data/test/fixtures/assets/public2/js/b.js +1 -0
- data/test/fixtures/assets/public2/js/c.js +1 -0
- data/test/fixtures/assets/public2/js/n.coffee +1 -0
- data/test/fixtures/back/config/user_levels.yml +3 -0
- data/test/fixtures/back/public/js/coffeescript.coffee +1 -0
- data/test/fixtures/back/templates/layouts/standard.css.cut +1 -0
- data/test/fixtures/back/templates/layouts/standard.js.cut +1 -0
- data/test/fixtures/example_application/config/database.yml +4 -4
- data/test/fixtures/helpers/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/helpers/templates/layouts/standard.mobile.cut +1 -0
- data/test/fixtures/images/vimlogo.pdf +0 -0
- data/test/fixtures/outputs/templates/layouts/standard.atom.cut +1 -0
- data/test/fixtures/permissions/config/user_levels.yml +6 -3
- data/test/fixtures/serialisation/class_hash.yaml.erb +1 -0
- data/test/fixtures/serialisation/root_hash.yaml.erb +2 -2
- data/test/fixtures/templates/extended/grandparent.html.cut +7 -7
- data/test/fixtures/templates/extended/main.html.cut +5 -5
- data/test/fixtures/templates/extended/parent.html.cut +8 -8
- data/test/fixtures/templates/extended/partial_with_locals.html.cut +1 -1
- data/test/fixtures/templates/extended/with_includes.html.cut +6 -6
- data/test/fixtures/templates/extended/with_includes_and_locals.html.cut +6 -7
- data/test/fixtures/templates/layouts/entries.html.cut +4 -4
- data/test/fixtures/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/templates/layouts/variables.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.rtf.cut +1 -0
- data/test/fixtures/templates/template_class/complex_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/complex_template.pdf.cut +2 -2
- data/test/fixtures/templates/template_class/default_template_style.html.cut +1 -1
- data/test/fixtures/templates/template_class/images_with_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.pdf.cut +2 -2
- data/test/fixtures/user_manager/config/user_levels.yml +9 -0
- data/test/functional/test_application.rb +7 -7
- data/test/functional/test_back.rb +352 -97
- data/test/functional/test_front.rb +71 -20
- data/test/functional/test_user_manager.rb +284 -0
- data/test/javascript/env.js +13505 -0
- data/test/javascript/test_markdown.rb +43 -3
- data/test/support/custom_matchers.rb +3 -2
- data/test/test_helper.rb +50 -9
- data/test/test_javascript.rb +13 -13
- data/test/ui_helper.rb +1 -1
- data/test/unit/test_alias.rb +79 -8
- data/test/unit/test_asset_bundler.rb +220 -0
- data/test/unit/test_assets.rb +213 -0
- data/test/unit/test_async.rb +55 -0
- data/test/unit/test_authentication.rb +52 -39
- data/test/unit/test_boxes.rb +20 -15
- data/test/unit/test_changesets.rb +261 -0
- data/test/unit/test_content.rb +73 -33
- data/test/unit/test_content_inheritance.rb +18 -18
- data/test/unit/test_extensions.rb +26 -0
- data/test/unit/test_fields.rb +303 -16
- data/test/unit/test_formats.rb +267 -34
- data/test/unit/test_helpers.rb +79 -2
- data/test/unit/test_images.rb +10 -0
- data/test/unit/test_layouts.rb +21 -13
- data/test/unit/test_modifications.rb +648 -0
- data/test/unit/test_page.rb +6 -2
- data/test/unit/test_permissions.rb +101 -27
- data/test/unit/test_piece.rb +4 -4
- data/test/unit/test_plugins.rb +3 -2
- data/test/unit/test_publishing.rb +332 -0
- data/test/unit/test_render.rb +118 -67
- data/test/unit/test_revisions.rb +546 -0
- data/test/unit/test_schema.rb +83 -1
- data/test/unit/test_search.rb +59 -0
- data/test/unit/test_serialisation.rb +2 -47
- data/test/unit/test_site.rb +217 -108
- data/test/unit/test_storage.rb +26 -0
- data/test/unit/test_structure.rb +2 -2
- data/test/unit/test_styles.rb +90 -75
- data/test/unit/test_table_scoping.rb +21 -17
- data/test/unit/test_templates.rb +75 -69
- data/test/{slow → unit}/test_visibility.rb +78 -22
- metadata +528 -221
- data/application/css/add_alias_dialogue.scss +0 -27
- data/application/css/min/14c2a35812c443001b15d8b12a4780f88c678035.css +0 -1
- data/application/css/min/565d4c25e82148acb01c45c8d675b37a08676d77.css +0 -1
- data/application/css/min/84dbe894ea96eafd321c30823d630817bfc4b03b.css +0 -1
- data/application/css/spontaneous.scss +0 -111
- data/application/css/unsupported.scss +0 -16
- data/application/css/variables.scss +0 -80
- data/application/js/min/2a0c2962537a3181fedfff5c92596ba6d3122dc9.js +0 -3
- data/application/js/min/4cf1c493d3379ecba5287758c61238034c0893f9.js +0 -2
- data/application/js/min/78ac6b99d96750bb6b9f9aad4cb9cd91cd03f391.js +0 -3
- data/application/js/min/b8abf302a824c35385ff517b34111e1710ff3b37.js +0 -2
- data/application/js/min/c8efb9b9f7c3f6613fcebc6be60f605b6570a382.js +0 -90
- data/application/static/diagonal-texture.png +0 -0
- data/application/static/editing-0-noise.png +0 -0
- data/application/static/editing-1-noise.png +0 -0
- data/application/static/editing-texture-1.png +0 -0
- data/application/static/editing-texture.png +0 -0
- data/application/static/editing-toolbar-shadow-bottom.png +0 -0
- data/application/static/editing-toolbar-shadow-top.png +0 -0
- data/application/static/inner-glow.png +0 -0
- data/application/static/item-buttons-highlight.png +0 -0
- data/application/static/item-buttons.png +0 -0
- data/application/static/paper-texture-dark.png +0 -0
- data/application/static/plus_alt.svg +0 -8
- data/application/static/select-arrow-root.png +0 -0
- data/application/static/slot-up-arrow.png +0 -0
- data/application/static/spontaneous.png +0 -0
- data/lib/cutaneous/context_helper.rb +0 -187
- data/lib/cutaneous/preview_context.rb +0 -32
- data/lib/cutaneous/preview_renderer.rb +0 -10
- data/lib/cutaneous/publish_context.rb +0 -10
- data/lib/cutaneous/publish_renderer.rb +0 -14
- data/lib/cutaneous/publish_template.rb +0 -62
- data/lib/cutaneous/publish_token_parser.rb +0 -8
- data/lib/cutaneous/renderer.rb +0 -124
- data/lib/cutaneous/request_context.rb +0 -9
- data/lib/cutaneous/request_renderer.rb +0 -15
- data/lib/cutaneous/request_template.rb +0 -11
- data/lib/cutaneous/request_token_parser.rb +0 -9
- data/lib/cutaneous/token_parser.rb +0 -125
- data/lib/cutaneous.rb +0 -48
- data/lib/spontaneous/render/context_base.rb +0 -143
- data/lib/spontaneous/render/development_renderer.rb +0 -14
- data/lib/spontaneous/render/engine.rb +0 -19
- data/lib/spontaneous/render/format/html.rb +0 -5
- data/lib/spontaneous/render/format.rb +0 -75
- data/lib/spontaneous/render/helpers/script_helper.rb +0 -17
- data/lib/spontaneous/render/helpers/stylesheet_helper.rb +0 -16
- data/lib/spontaneous/render/helpers.rb +0 -14
- data/lib/spontaneous/render/preview_context.rb +0 -8
- data/lib/spontaneous/render/preview_renderer.rb +0 -24
- data/lib/spontaneous/render/publish_context.rb +0 -22
- data/lib/spontaneous/render/published_renderer.rb +0 -53
- data/lib/spontaneous/render/publishing_renderer.rb +0 -16
- data/lib/spontaneous/render/render_cache.rb +0 -26
- data/lib/spontaneous/render/renderer.rb +0 -50
- data/lib/spontaneous/render/request_context.rb +0 -8
- data/lib/spontaneous/render.rb +0 -214
- data/test/experimental/test_cutaneous.rb +0 -309
- data/test/fixtures/application/css/test.less +0 -5
- data/test/slow/test_publishing.rb +0 -1006
- /data/application/css/{developer.scss → developer.css.scss} +0 -0
- /data/application/js/vendor/{jquery-1.7.1.min.js → jquery.js} +0 -0
- /data/application/static/{location-arrow.png → location-arrow-c1c1d3ca472481c61a0a5f8cb289d743.png} +0 -0
- /data/application/static/{missing.png → missing-911ce6dbd9f4602e0f3fbcd7e78846a2.png} +0 -0
- /data/application/static/{orange-down-arrow.png → orange-down-arrow-395ae1929e8662b2ff0977daf12c35bb.png} +0 -0
- /data/application/static/{page-browser-next.png → page-browser-next-ce781a242c23b980b99b9db7abc20b05.png} +0 -0
- /data/application/static/{plus-box.png → plus-box-dcde74a1e496f68298c9b443caa1c5d5.png} +0 -0
- /data/application/static/{select-arrow.png → select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png} +0 -0
- /data/application/static/{slot-down-arrow.png → slot-down-arrow-59ad5f5ee5b52a7ebd00bca4b3104194.png} +0 -0
- /data/application/static/{splash.png → splash-65b493a714df9b8b3ab170103401b53d.png} +0 -0
- /data/application/static/{spot.png → spot-71fab1d2f065034f5fc15e7bea2ad36c.png} +0 -0
- /data/application/static/{spot.svg → spot-8505041082d8d3bbe8d34c29dddb3b7d.svg} +0 -0
- /data/application/static/{texture.png → texture-03f7627e8264b1d607113ab32c593a58.png} +0 -0
@@ -0,0 +1,261 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.expand_path('../../test_helper', __FILE__)
|
4
|
+
|
5
|
+
|
6
|
+
class ChangeTest < MiniTest::Spec
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@now = Time.now
|
10
|
+
@site = setup_site
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
teardown_site
|
15
|
+
end
|
16
|
+
|
17
|
+
context "Changes" do
|
18
|
+
setup do
|
19
|
+
@revision = 1
|
20
|
+
stub_time(@now)
|
21
|
+
|
22
|
+
# DB.logger = Logger.new($stdout)
|
23
|
+
Content.delete
|
24
|
+
|
25
|
+
class Page < Spontaneous::Page
|
26
|
+
field :title, :string, :default => "New Page"
|
27
|
+
box :things
|
28
|
+
end
|
29
|
+
class Piece < Spontaneous::Piece
|
30
|
+
box :things
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
teardown do
|
35
|
+
ChangeTest.send(:remove_const, :Page) rescue nil
|
36
|
+
ChangeTest.send(:remove_const, :Piece) rescue nil
|
37
|
+
Content.delete_revision(@revision) rescue nil
|
38
|
+
Content.delete_revision(@revision+1) rescue nil
|
39
|
+
Content.delete
|
40
|
+
DB.logger = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
should "list all newly created pages" do
|
46
|
+
root = Page.create(:title => "root")
|
47
|
+
root[:first_published_at] = root[:last_published_at] = root.modified_at + 1000
|
48
|
+
root.save
|
49
|
+
|
50
|
+
5.times { |i| root.things << Page.create(:title => "Page #{i+1}") }
|
51
|
+
|
52
|
+
result = Change.outstanding
|
53
|
+
result.must_be_instance_of(Array)
|
54
|
+
result.length.should == 5
|
55
|
+
|
56
|
+
result.map(&:class).should == [Change]*5
|
57
|
+
|
58
|
+
Set.new(result.map(&:page_id)).should == Set.new(root.things.map { |p| p.id })
|
59
|
+
end
|
60
|
+
|
61
|
+
should "not list new pieces as available for publish" do
|
62
|
+
root = Page.create(:title => "root")
|
63
|
+
Content.publish(@revision)
|
64
|
+
# force root to appear in the modified lists -- need this because otherwise the changes happen
|
65
|
+
# more quickly than the resolution of the timestamps can register
|
66
|
+
root[:first_published_at] = root[:last_published_at] = root.modified_at - 1000
|
67
|
+
root.things << Piece.new
|
68
|
+
root.save.reload
|
69
|
+
result = Change.outstanding
|
70
|
+
result.length.should == 1
|
71
|
+
result.first.page.should == root
|
72
|
+
end
|
73
|
+
|
74
|
+
should "not list pages that have been published" do
|
75
|
+
root = Page.create(:title => "root")
|
76
|
+
|
77
|
+
Content.publish(@revision)
|
78
|
+
|
79
|
+
5.times { |i| root.things << Page.create(:title => "Page #{i+1}") }
|
80
|
+
root.save
|
81
|
+
|
82
|
+
Content.publish(@revision+1, [root.id, root.things.first.id])
|
83
|
+
|
84
|
+
result = Change.outstanding
|
85
|
+
result.length.should == 4
|
86
|
+
Set.new(result.map(&:page_id).flatten).should == Set.new(root.things[1..-1].map(&:id))
|
87
|
+
end
|
88
|
+
|
89
|
+
should "group unpublished parents with their children" do
|
90
|
+
root = Page.create(:title => "root")
|
91
|
+
|
92
|
+
Content.publish(@revision)
|
93
|
+
|
94
|
+
root.reload
|
95
|
+
page1 = Page.new(:title => "Page 1")
|
96
|
+
root.things << page1
|
97
|
+
new_child1 = Page.new(:title => "New Child 1")
|
98
|
+
page1.things << new_child1
|
99
|
+
new_parent = Page.new(:title => "New Parent")
|
100
|
+
new_child2 = Page.new(:title => "New Child 2")
|
101
|
+
new_child3 = Page.new(:title => "New Child 3")
|
102
|
+
root.things << new_parent
|
103
|
+
new_parent.things << new_child2
|
104
|
+
new_child2.things << new_child3
|
105
|
+
|
106
|
+
pages = [root, page1, new_child1, new_parent, new_child2, new_child3]
|
107
|
+
pages.each(&:save)
|
108
|
+
|
109
|
+
|
110
|
+
Content.publish(@revision+1, [root.id])
|
111
|
+
result = Change.outstanding
|
112
|
+
|
113
|
+
result.length.should == 5
|
114
|
+
|
115
|
+
id_groups = result.map { |change|
|
116
|
+
[change.page.id, change.dependent.map(&:id)]
|
117
|
+
}
|
118
|
+
Set.new(id_groups).should == Set.new([
|
119
|
+
[page1.id, []],
|
120
|
+
[new_child1.id, [page1.id]],
|
121
|
+
[new_parent.id, []],
|
122
|
+
[new_child2.id, [new_parent.id ]],
|
123
|
+
[new_child3.id, [new_parent.id, new_child2.id]]
|
124
|
+
])
|
125
|
+
end
|
126
|
+
|
127
|
+
should "successfully publish list of dependent pages" do
|
128
|
+
root = Page.create(:title => "root")
|
129
|
+
|
130
|
+
Content.publish(@revision)
|
131
|
+
|
132
|
+
root.reload
|
133
|
+
page1 = Page.new(:title => "Page 1")
|
134
|
+
root.things << page1
|
135
|
+
new_child1 = Page.new(:title => "New Child 1")
|
136
|
+
page1.things << new_child1
|
137
|
+
new_parent = Page.new(:title => "New Parent")
|
138
|
+
new_child2 = Page.new(:title => "New Child 2")
|
139
|
+
new_child3 = Page.new(:title => "New Child 3")
|
140
|
+
root.things << new_parent
|
141
|
+
new_parent.things << new_child2
|
142
|
+
new_child2.things << new_child3
|
143
|
+
|
144
|
+
pages = [root, page1, new_child1, new_parent, new_child2, new_child3]
|
145
|
+
pages.each(&:save)
|
146
|
+
|
147
|
+
|
148
|
+
Content.publish(@revision+1, [root.id])
|
149
|
+
result = Change.outstanding
|
150
|
+
|
151
|
+
e = nil
|
152
|
+
begin
|
153
|
+
pages = Spontaneous::Change.include_dependencies([new_child3])
|
154
|
+
Content.publish(@revision+2, pages)
|
155
|
+
Content.delete_revision(@revision + 2) rescue nil
|
156
|
+
rescue => e
|
157
|
+
Content.delete_revision(@revision + 2) rescue nil
|
158
|
+
raise
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
should "provide page & dependency information in serializable format" do
|
163
|
+
root = Page.create(:title => "root")
|
164
|
+
|
165
|
+
Content.publish(@revision)
|
166
|
+
|
167
|
+
root.reload
|
168
|
+
page1 = Page.new(:title => "Page 1")
|
169
|
+
root.things << page1
|
170
|
+
new_child1 = Page.new(:title => "New Child 1")
|
171
|
+
page1.things << new_child1
|
172
|
+
root.save
|
173
|
+
|
174
|
+
Content.publish(@revision+1, [root.id])
|
175
|
+
result = Change.outstanding
|
176
|
+
change = result.detect { |change| change.page.id == new_child1.id }
|
177
|
+
change.export.should == {
|
178
|
+
:id => new_child1.id,
|
179
|
+
:title => new_child1.title.value,
|
180
|
+
:url => new_child1.path,
|
181
|
+
:published_at => nil,
|
182
|
+
:modified_at => new_child1.modified_at.httpdate,
|
183
|
+
# :editor_login => "someone",
|
184
|
+
:depth => new_child1.depth,
|
185
|
+
:side_effects => {},
|
186
|
+
:dependent => [{
|
187
|
+
:id => page1.id,
|
188
|
+
:depth => page1.depth,
|
189
|
+
:title => page1.title.value,
|
190
|
+
:url => page1.path,
|
191
|
+
:side_effects => {},
|
192
|
+
:published_at => nil,
|
193
|
+
:modified_at => page1.modified_at.httpdate,
|
194
|
+
}]
|
195
|
+
}
|
196
|
+
end
|
197
|
+
|
198
|
+
should "order modified changes in reverse modification date order" do
|
199
|
+
root = Page.create(:title => "root")
|
200
|
+
|
201
|
+
Content.publish(@revision)
|
202
|
+
|
203
|
+
root.reload
|
204
|
+
page1 = Page.new(:title => "Page 1")
|
205
|
+
root.things << page1
|
206
|
+
new_child1 = Page.new(:title => "New Child 1")
|
207
|
+
page1.things << new_child1
|
208
|
+
root.save
|
209
|
+
last = Time.now + 100
|
210
|
+
S::Content.filter(:id => new_child1.id).update(:modified_at => last)
|
211
|
+
result = Change.outstanding
|
212
|
+
assert result.first.modified_at > result.last.modified_at, "Change list in incorrect order"
|
213
|
+
end
|
214
|
+
|
215
|
+
should "provide information on side effects of publishing page with path changes" do
|
216
|
+
root = Page.create(:title => "root")
|
217
|
+
|
218
|
+
|
219
|
+
root.reload
|
220
|
+
page1 = Page.new(:title => "Page 1")
|
221
|
+
root.things << page1
|
222
|
+
new_child1 = Page.new(:title => "New Child 1")
|
223
|
+
page1.things << new_child1
|
224
|
+
root.save
|
225
|
+
|
226
|
+
Content.publish(@revision)
|
227
|
+
|
228
|
+
old_slug = page1.slug
|
229
|
+
page1.slug = "changed"
|
230
|
+
page1.save
|
231
|
+
|
232
|
+
result = Change.outstanding
|
233
|
+
change = result.detect { |change| change.page.id == page1.id }
|
234
|
+
change.export[:side_effects].should == {
|
235
|
+
:slug => [{ :count => 1, :created_at => @now.httpdate, :old_value => old_slug, :new_value => "changed"}]
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
should "provide information on side effects of publishing page with visibility changes" do
|
240
|
+
root = Page.create(:title => "root")
|
241
|
+
|
242
|
+
|
243
|
+
root.reload
|
244
|
+
page1 = Page.new(:title => "Page 1")
|
245
|
+
root.things << page1
|
246
|
+
new_child1 = Page.new(:title => "New Child 1")
|
247
|
+
page1.things << new_child1
|
248
|
+
root.save
|
249
|
+
|
250
|
+
Content.publish(@revision)
|
251
|
+
|
252
|
+
page1.hide!
|
253
|
+
|
254
|
+
result = Change.outstanding
|
255
|
+
change = result.detect { |change| change.page.id == page1.id }
|
256
|
+
change.export[:side_effects].should == {
|
257
|
+
:visibility => [{ :count => 1, :created_at => @now.httpdate, :old_value => false, :new_value => true}]
|
258
|
+
}
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
data/test/unit/test_content.rb
CHANGED
@@ -8,15 +8,22 @@ class ContentTest < MiniTest::Spec
|
|
8
8
|
setup do
|
9
9
|
@site = setup_site
|
10
10
|
class Piece < Spontaneous::Piece; end
|
11
|
+
class Page < Spontaneous::Page; end
|
11
12
|
class C < Piece; end
|
13
|
+
class P < Page; end
|
12
14
|
C.box :things
|
15
|
+
P.box :box1
|
16
|
+
P.box :box2
|
13
17
|
end
|
14
18
|
|
15
19
|
teardown do
|
16
20
|
teardown_site
|
17
21
|
ContentTest.send(:remove_const, :Piece) rescue nil
|
22
|
+
ContentTest.send(:remove_const, :Page) rescue nil
|
18
23
|
ContentTest.send(:remove_const, :C) rescue nil
|
24
|
+
ContentTest.send(:remove_const, :P) rescue nil
|
19
25
|
end
|
26
|
+
|
20
27
|
context "Content instances" do
|
21
28
|
should "evaluate instance code" do
|
22
29
|
@instance = C.create({
|
@@ -37,20 +44,24 @@ class ContentTest < MiniTest::Spec
|
|
37
44
|
Content.delete
|
38
45
|
end
|
39
46
|
should "be initialised empty" do
|
40
|
-
@instance.
|
47
|
+
@instance.contents.should == []
|
48
|
+
end
|
49
|
+
|
50
|
+
should "provide a #target method poiting to itself" do
|
51
|
+
@instance.target.should == @instance
|
41
52
|
end
|
42
53
|
|
43
54
|
should "accept addition of child content" do
|
44
55
|
e = C.new
|
45
56
|
@instance.things << e
|
46
|
-
@instance.
|
47
|
-
@instance.things.
|
48
|
-
@instance.
|
49
|
-
@instance.
|
50
|
-
@instance.
|
51
|
-
@instance.
|
57
|
+
@instance.contents.length.should == 1
|
58
|
+
@instance.things.contents.length.should == 1
|
59
|
+
@instance.contents.first.should == e
|
60
|
+
@instance.contents.first.container.should == @instance.things
|
61
|
+
@instance.contents.first.owner.should == @instance
|
62
|
+
@instance.contents.first.parent.should == @instance
|
52
63
|
e.visibility_path.should == "#{@instance.id}"
|
53
|
-
@instance.
|
64
|
+
@instance.contents.first.visibility_path.should == "#{@instance.id}"
|
54
65
|
end
|
55
66
|
|
56
67
|
should "accept addition of multiple children" do
|
@@ -58,20 +69,20 @@ class ContentTest < MiniTest::Spec
|
|
58
69
|
f = C.new
|
59
70
|
@instance.things << e
|
60
71
|
@instance.things << f
|
61
|
-
@instance.
|
62
|
-
@instance.things.
|
63
|
-
@instance.
|
64
|
-
@instance.things.
|
65
|
-
@instance.
|
66
|
-
@instance.things.
|
67
|
-
@instance.
|
68
|
-
@instance.
|
69
|
-
@instance.
|
70
|
-
@instance.
|
71
|
-
@instance.
|
72
|
-
@instance.
|
73
|
-
@instance.
|
74
|
-
@instance.
|
72
|
+
@instance.contents.length.should == 2
|
73
|
+
@instance.things.contents.length.should == 2
|
74
|
+
@instance.contents.first.should == e
|
75
|
+
@instance.things.contents.first.should == e
|
76
|
+
@instance.contents.last.should == f
|
77
|
+
@instance.things.contents.last.should == f
|
78
|
+
@instance.contents.first.container.should == @instance.things
|
79
|
+
@instance.contents.last.container.should == @instance.things
|
80
|
+
@instance.contents.first.parent.should == @instance
|
81
|
+
@instance.contents.last.parent.should == @instance
|
82
|
+
@instance.contents.first.owner.should == @instance
|
83
|
+
@instance.contents.last.owner.should == @instance
|
84
|
+
@instance.contents.first.visibility_path.should == "#{@instance.id}"
|
85
|
+
@instance.contents.last.visibility_path.should == "#{@instance.id}"
|
75
86
|
end
|
76
87
|
|
77
88
|
should "allow for a deep hierarchy" do
|
@@ -79,8 +90,8 @@ class ContentTest < MiniTest::Spec
|
|
79
90
|
f = C.new
|
80
91
|
@instance.things << e
|
81
92
|
e.things << f
|
82
|
-
@instance.
|
83
|
-
@instance.
|
93
|
+
@instance.contents.length.should == 1
|
94
|
+
@instance.contents.first.should == e
|
84
95
|
e.owner.id.should == @instance.id
|
85
96
|
e.parent.id.should == @instance.id
|
86
97
|
e.container.should == @instance.things
|
@@ -105,8 +116,8 @@ class ContentTest < MiniTest::Spec
|
|
105
116
|
e = C[e.id]
|
106
117
|
f = C[f.id]
|
107
118
|
|
108
|
-
i.
|
109
|
-
i.
|
119
|
+
i.contents.length.should == 1
|
120
|
+
i.contents.first.should == e
|
110
121
|
|
111
122
|
e.container.should == i.things
|
112
123
|
e.owner.should == i
|
@@ -114,9 +125,9 @@ class ContentTest < MiniTest::Spec
|
|
114
125
|
f.container.should == e.things
|
115
126
|
f.parent.should == e
|
116
127
|
f.owner.should == e
|
117
|
-
e.entry.should == i.
|
118
|
-
f.entry.should == e.
|
119
|
-
e.
|
128
|
+
e.entry.should == i.contents.first
|
129
|
+
f.entry.should == e.contents.first
|
130
|
+
e.contents.first.should == f
|
120
131
|
end
|
121
132
|
|
122
133
|
should "have a list of child nodes" do
|
@@ -131,10 +142,35 @@ class ContentTest < MiniTest::Spec
|
|
131
142
|
i = C[@instance.id]
|
132
143
|
e = C[e.id]
|
133
144
|
f = C[f.id]
|
134
|
-
i.
|
135
|
-
e.
|
145
|
+
i.contents.should == [e]
|
146
|
+
e.contents.should == [f]
|
147
|
+
end
|
148
|
+
|
149
|
+
should "provide a list of non-page contents" do
|
150
|
+
p = P.new
|
151
|
+
|
152
|
+
c1 = C.new
|
153
|
+
c2 = C.new
|
154
|
+
c3 = C.new
|
155
|
+
p1 = P.new
|
156
|
+
p2 = P.new
|
157
|
+
p3 = P.new
|
158
|
+
|
159
|
+
p.box1 << c1
|
160
|
+
p.box1 << c2
|
161
|
+
p.box1 << p1
|
162
|
+
|
163
|
+
p.box2 << p3
|
164
|
+
p.box2 << c3
|
165
|
+
|
166
|
+
[p, c1, c2, c3, p1, p2, p3].each { |c| c.save; c.reload }
|
167
|
+
|
168
|
+
p = P[p.id]
|
169
|
+
|
170
|
+
p.pieces.should == [c1, c2, c3]
|
136
171
|
end
|
137
172
|
|
173
|
+
|
138
174
|
should "allow for testing of position" do
|
139
175
|
e = C.new
|
140
176
|
f = C.new
|
@@ -223,8 +259,8 @@ class ContentTest < MiniTest::Spec
|
|
223
259
|
@b.destroy
|
224
260
|
C.count.should == 2
|
225
261
|
@a.reload
|
226
|
-
@a.
|
227
|
-
@a.
|
262
|
+
@a.contents.length.should == 1
|
263
|
+
@a.contents.first.should == @d.reload
|
228
264
|
C.all.map { |c| c.id }.sort.should == [@a, @d].map { |c| c.id }.sort
|
229
265
|
end
|
230
266
|
|
@@ -292,6 +328,10 @@ class ContentTest < MiniTest::Spec
|
|
292
328
|
@b.reload
|
293
329
|
@b.visibility_path.should == @r.id.to_s
|
294
330
|
end
|
331
|
+
|
332
|
+
should "ensure that child pages have their visibility paths updated" do
|
333
|
+
flunk "Implement this"
|
334
|
+
end
|
295
335
|
end
|
296
336
|
|
297
337
|
|
@@ -49,26 +49,26 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
49
49
|
end
|
50
50
|
|
51
51
|
should "aaa correctly type subclasses found via Content" do
|
52
|
-
Content.all.map { |c| c.class }.should == \
|
53
|
-
[PageClass1, PageClass11, PageClass111, PageClass2, PageClass22,
|
54
|
-
PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22]
|
55
|
-
Content.all.should == \
|
56
|
-
[@page1, @page11, @page111, @page2, @page22,
|
57
|
-
@piece1, @piece11, @piece111, @piece2, @piece22]
|
52
|
+
Set.new(Content.all.map { |c| c.class }).should == \
|
53
|
+
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22,
|
54
|
+
PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
55
|
+
Set.new(Content.all).should == \
|
56
|
+
Set.new([@page1, @page11, @page111, @page2, @page22,
|
57
|
+
@piece1, @piece11, @piece111, @piece2, @piece22])
|
58
58
|
end
|
59
59
|
|
60
60
|
context "Pages" do
|
61
61
|
|
62
62
|
should "type subclasses found via Page" do
|
63
|
-
::Page.all.map { |c| c.class }.should == \
|
64
|
-
[PageClass1, PageClass11, PageClass111, PageClass2, PageClass22]
|
65
|
-
::Page.all.should == [@page1, @page11, @page111, @page2, @page22]
|
63
|
+
Set.new(::Page.all.map { |c| c.class }).should == \
|
64
|
+
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22])
|
65
|
+
Set.new(::Page.all).should == Set.new([@page1, @page11, @page111, @page2, @page22])
|
66
66
|
end
|
67
67
|
|
68
68
|
should "type subclasses found via Spontaneous::Page" do
|
69
|
-
Spontaneous::Page.all.map { |c| c.class }.should == \
|
70
|
-
[PageClass1, PageClass11, PageClass111, PageClass2, PageClass22]
|
71
|
-
Spontaneous::Page.all.should == [@page1, @page11, @page111, @page2, @page22]
|
69
|
+
Set.new(Spontaneous::Page.all.map { |c| c.class }).should == \
|
70
|
+
Set.new([PageClass1, PageClass11, PageClass111, PageClass2, PageClass22])
|
71
|
+
Set.new(Spontaneous::Page.all).should == Set.new([@page1, @page11, @page111, @page2, @page22])
|
72
72
|
end
|
73
73
|
|
74
74
|
should "only find instances of a single class when searching via that subclass" do
|
@@ -82,14 +82,14 @@ class ContentInheritanceTest < MiniTest::Spec
|
|
82
82
|
|
83
83
|
context "Pieces" do
|
84
84
|
should "type subclasses found via Spontaneous::Piece" do
|
85
|
-
Spontaneous::Piece.all.map { |c| c.class }.should == \
|
86
|
-
[PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22]
|
87
|
-
Spontaneous::Piece.all.should == [@piece1, @piece11, @piece111, @piece2, @piece22]
|
85
|
+
Set.new(Spontaneous::Piece.all.map { |c| c.class }).should == \
|
86
|
+
Set.new([PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
87
|
+
Set.new(Spontaneous::Piece.all).should == Set.new([@piece1, @piece11, @piece111, @piece2, @piece22])
|
88
88
|
end
|
89
89
|
should "type subclasses found via Piece" do
|
90
|
-
::Piece.all.map { |c| c.class }.should == \
|
91
|
-
[PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22]
|
92
|
-
::Piece.all.should == [@piece1, @piece11, @piece111, @piece2, @piece22]
|
90
|
+
Set.new(::Piece.all.map { |c| c.class }).should == \
|
91
|
+
Set.new([PieceClass1, PieceClass11, PieceClass111, PieceClass2, PieceClass22])
|
92
|
+
Set.new(::Piece.all).should == Set.new([@piece1, @piece11, @piece111, @piece2, @piece22])
|
93
93
|
end
|
94
94
|
|
95
95
|
should "only find instances of a single class when searching via that subclass" do
|
@@ -9,12 +9,38 @@ class ExtensionsTest < MiniTest::Spec
|
|
9
9
|
("this" / "that").should == "this/that"
|
10
10
|
("/this" / "/that").should == "/this/that"
|
11
11
|
end
|
12
|
+
|
13
|
+
should "override the | method to return the argument if empty" do
|
14
|
+
("" | "that").should == "that"
|
15
|
+
("this" | "that").should == "this"
|
16
|
+
end
|
17
|
+
|
18
|
+
should "override the or method to return the argument if empty" do
|
19
|
+
("".or("that")).should == "that"
|
20
|
+
("this".or("that")).should == "this"
|
21
|
+
end
|
22
|
+
|
23
|
+
should "return self for #value" do
|
24
|
+
"this".value.should == "this"
|
25
|
+
"this".value(:html).should == "this"
|
26
|
+
"this".value(:smsx).should == "this"
|
27
|
+
end
|
12
28
|
end
|
13
29
|
|
14
30
|
context "Nil" do
|
15
31
|
should "always return the argument for the slash switch" do
|
16
32
|
(nil / "something").should == "something"
|
17
33
|
end
|
34
|
+
should "always return the argument for the #or switch" do
|
35
|
+
(nil.or("something")).should == "something"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "Enumerable" do
|
40
|
+
should "correctly slice_between elements" do
|
41
|
+
result = ["js", "coffee", "coffee", "js", "coffee"].slice_between { |prev, current| prev != current }.to_a
|
42
|
+
result.should == [["js"], ["coffee", "coffee"], ["js"], ["coffee"]]
|
43
|
+
end
|
18
44
|
end
|
19
45
|
end
|
20
46
|
|