atrium 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -1
- data/.rspec +2 -0
- data/.rvmrc +1 -1
- data/CONTRIBUTING.md +73 -0
- data/Gemfile +27 -2
- data/Gemfile.lock +122 -246
- data/Guardfile +40 -10
- data/LICENSE +14 -0
- data/README.mkd +23 -39
- data/ROADMAP.mkd +41 -9
- data/Rakefile +39 -4
- data/app/assets/images/atrium/remove.png +0 -0
- data/app/assets/images/atrium/white-arrow.png +0 -0
- data/app/assets/javascripts/{atrium/atrium.js → atrium.js} +8 -153
- data/app/assets/stylesheets/{atrium/atrium.css → atrium.css} +110 -37
- data/app/assets/stylesheets/atrium/collections.css +4 -0
- data/app/assets/stylesheets/atrium/descriptions.css +4 -0
- data/app/assets/stylesheets/atrium/exhibits.css +4 -0
- data/app/assets/stylesheets/atrium/reset.css +69 -0
- data/app/assets/stylesheets/atrium/showcases.css +4 -0
- data/app/assets/stylesheets/atrium/theme.css +248 -0
- data/app/controllers/atrium/application_controller.rb +12 -0
- data/app/controllers/atrium/browse_levels_controller.rb +22 -0
- data/app/controllers/atrium/collections_controller.rb +42 -138
- data/app/controllers/atrium/descriptions_controller.rb +27 -146
- data/app/controllers/atrium/exhibits_controller.rb +51 -77
- data/app/controllers/atrium/order_controller.rb +74 -0
- data/app/controllers/atrium/showcases_controller.rb +96 -117
- data/app/helpers/atrium/application_helper.rb +8 -0
- data/app/helpers/atrium/collections_helper.rb +44 -0
- data/app/helpers/atrium/descriptions_helper.rb +4 -0
- data/app/helpers/atrium/exhibits_helper.rb +4 -0
- data/app/helpers/atrium/showcases_helper.rb +34 -0
- data/app/models/atrium/browse_level.rb +21 -11
- data/app/models/atrium/collection.rb +70 -36
- data/app/models/atrium/configuration.rb +66 -0
- data/app/models/atrium/description.rb +39 -88
- data/app/models/atrium/essay.rb +4 -5
- data/app/models/atrium/exhibit.rb +28 -19
- data/app/models/atrium/is_showcased_mixin.rb +34 -0
- data/app/models/atrium/query_param_mixin.rb +105 -0
- data/app/models/atrium/search/facet.rb +14 -25
- data/app/models/atrium/search/facet_selection.rb +10 -12
- data/app/models/atrium/showcase.rb +105 -95
- data/app/models/atrium/showcase/facet_selection.rb +18 -18
- data/app/models/atrium/showcase/featured_selection.rb +15 -0
- data/app/services/browse_level_evaluation_service.rb +131 -0
- data/app/services/current_filter_query_params_extraction_service.rb +91 -0
- data/app/services/navigation_tree.rb +13 -0
- data/app/services/params_adaptor_for_filter.rb +18 -0
- data/app/views/atrium/collections/_form.html.erb +149 -72
- data/app/views/atrium/collections/_head.html.erb +3 -0
- data/app/views/atrium/collections/edit.html.erb +1 -4
- data/app/views/atrium/collections/index.html.erb +14 -0
- data/app/views/atrium/collections/new.html.erb +2 -5
- data/app/views/atrium/collections/show.html.erb +11 -29
- data/app/views/atrium/descriptions/_form.html.erb +47 -49
- data/app/views/atrium/descriptions/edit.html.erb +1 -2
- data/app/views/atrium/descriptions/index.html.erb +2 -8
- data/app/views/atrium/descriptions/new.html.erb +2 -1
- data/app/views/atrium/descriptions/show.html.erb +2 -20
- data/app/views/atrium/exhibits/_exhibit.html.erb +1 -0
- data/app/views/atrium/exhibits/_form.html.erb +143 -96
- data/app/views/atrium/exhibits/edit.html.erb +1 -8
- data/app/views/atrium/exhibits/index.html.erb +2 -0
- data/app/views/atrium/exhibits/new.html.erb +0 -5
- data/app/views/atrium/exhibits/show.html.erb +2 -34
- data/app/views/atrium/showcases/_configure_menu.html.erb +55 -0
- data/app/views/atrium/showcases/_form.html.erb +40 -0
- data/app/views/atrium/showcases/edit.html.erb +3 -0
- data/app/views/atrium/showcases/index.html.erb +32 -0
- data/app/views/atrium/showcases/new.html.erb +3 -0
- data/app/views/atrium/showcases/show.html.erb +2 -1
- data/app/views/layouts/atrium.html.erb +16 -24
- data/app/views/layouts/atrium/application.html.erb +49 -0
- data/app/views/layouts/atrium/themes/default.html.erb +15 -0
- data/app/views/shared/_list_searchs.html.erb +4 -0
- data/app/views/shared/_navigation.html.erb +19 -0
- data/atrium.gemspec +31 -64
- data/config/routes.rb +40 -10
- data/{lib/generators/atrium/templates/migrations/create_atrium_collections.rb → db/migrate/20120730170406_create_atrium_collections.rb} +2 -1
- data/{lib/generators/atrium/templates/migrations/create_atrium_showcases.rb → db/migrate/20120731134846_create_atrium_showcases.rb} +3 -4
- data/{lib/generators/atrium/templates/migrations/create_atrium_exhibits.rb → db/migrate/20120731134856_create_atrium_exhibits.rb} +2 -1
- data/{lib/generators/atrium/templates/migrations/create_atrium_descriptions.rb → db/migrate/20120731134904_create_atrium_descriptions.rb} +2 -1
- data/{lib/generators/atrium/templates/migrations/create_atrium_essays.rb → db/migrate/20120731135534_create_atrium_essays.rb} +3 -2
- data/{lib/generators/atrium/templates/migrations/create_atrium_search_facets.rb → db/migrate/20120731135721_create_atrium_search_facets.rb} +1 -1
- data/{lib/generators/atrium/templates/migrations/create_atrium_showcase_facet_selections.rb → db/migrate/20120731140621_create_atrium_showcase_facet_selections.rb} +6 -2
- data/{lib/generators/atrium/templates/migrations/create_atrium_browse_levels.rb → db/migrate/20120801145241_create_atrium_browse_levels.rb} +1 -1
- data/db/migrate/20120820183808_create_selected_items.rb +16 -0
- data/db/migrate/20120823135716_update_atrium_collection_indices.rb +13 -0
- data/db/migrate/20120823143315_add_lookup_indices_as_required.rb +11 -0
- data/lib/atrium.rb +40 -36
- data/lib/atrium/engine.rb +4 -8
- data/lib/atrium/exceptions.rb +10 -0
- data/lib/atrium/version.rb +2 -2
- data/lib/generators/atrium/install/USAGE +8 -0
- data/lib/generators/atrium/install/install_generator.rb +86 -0
- data/lib/generators/atrium/install/templates/atrium_initializer.rb +21 -0
- data/lib/generators/atrium/install/templates/controllers/atrium_base_controller.rb +18 -0
- data/lib/generators/atrium/install/templates/controllers/collections_controller.rb +40 -0
- data/lib/generators/atrium/install/templates/controllers/descriptions_controller.rb +36 -0
- data/lib/generators/atrium/install/templates/controllers/exhibits_controller.rb +47 -0
- data/lib/generators/atrium/install/templates/controllers/selected_items_controller.rb +26 -0
- data/lib/generators/atrium/install/templates/helpers/application_helper.rb +42 -0
- data/lib/generators/atrium/install/templates/helpers/collections_helper.rb +15 -0
- data/lib/generators/atrium/install/templates/helpers/navigation_helper.rb +62 -0
- data/lib/generators/atrium/install/templates/helpers/solr_helper.rb +138 -0
- data/lib/generators/atrium/install/templates/models/selected_item.rb +7 -0
- data/lib/generators/atrium/install/templates/views/collections/_document.html.erb +19 -0
- data/lib/generators/atrium/install/templates/views/collections/_exhibits.html.erb +3 -0
- data/lib/generators/atrium/install/templates/views/collections/_pagination.html.erb +6 -0
- data/lib/generators/atrium/install/templates/views/collections/browse.html.erb +16 -0
- data/lib/generators/atrium/install/templates/views/collections/show.html.erb +19 -0
- data/lib/generators/atrium/install/templates/views/descriptions/show.html.erb +8 -0
- data/lib/generators/atrium/install/templates/views/exhibits/_document.html.erb +19 -0
- data/lib/generators/atrium/install/templates/views/exhibits/_pagination.html.erb +6 -0
- data/lib/generators/atrium/install/templates/views/exhibits/show.html.erb +28 -0
- data/lib/generators/atrium/install/templates/views/folder/_selected_items_form.html.erb +8 -0
- data/lib/generators/atrium/install/templates/views/folder/index.html.erb +45 -0
- data/lib/generators/atrium/install/templates/views/shared/_document_list.html.erb +14 -0
- data/lib/generators/atrium/install/templates/views/shared/_featured_sources.html.erb +19 -0
- data/lib/generators/atrium/install/templates/views/shared/_list_descriptions.html.erb +25 -0
- data/lib/generators/atrium/install/templates/views/shared/_masthead.html.erb +19 -0
- data/lib/generators/atrium/install/templates/views/shared/_navigation_browse_level.html.erb +34 -0
- data/lib/generators/atrium/install/templates/views/shared/_showcases.html.erb +12 -0
- data/lib/generators/atrium/install/templates/views/shared/_side_bar_navigation.html.erb +20 -0
- data/lib/generators/atrium/service/USAGE +9 -0
- data/lib/generators/atrium/service/service_generator.rb +16 -0
- data/lib/generators/atrium/service/templates/service.rb.erb +2 -0
- data/lib/generators/atrium/service/templates/service_spec.rb.erb +4 -0
- data/lib/generators/atrium/theme/USAGE +8 -0
- data/lib/generators/atrium/theme/templates/theme.html.erb +14 -0
- data/lib/generators/atrium/theme/theme_generator.rb +11 -0
- data/lib/tasks/atrium_tasks.rake +4 -0
- data/script/rails +10 -0
- data/spec/atrium_spec.rb +10 -0
- data/spec/controllers/atrium/application_controller_spec.rb +7 -0
- data/spec/controllers/atrium/collections_controller_spec.rb +125 -0
- data/spec/controllers/atrium/descriptions_controller_spec.rb +142 -0
- data/spec/controllers/atrium/exhibits_controller_spec.rb +102 -0
- data/spec/controllers/atrium/order_controller_spec.rb +100 -0
- data/spec/controllers/atrium/showcases_controller_spec.rb +217 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/collection.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/schema.rb +124 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/test/fixtures/collections.yml +11 -0
- data/spec/dummy/test/unit/collection_test.rb +7 -0
- data/spec/factories/atrium_collections.rb +8 -0
- data/spec/factories/atrium_exhibits.rb +9 -0
- data/spec/factories/atrium_search_facets.rb +8 -0
- data/spec/factories/atrium_showcases.rb +25 -0
- data/spec/helpers/atrium/collections_helper_spec.rb +57 -0
- data/spec/helpers/atrium/showcases_helper_spec.rb +56 -0
- data/spec/models/atrium/browse_level_spec.rb +56 -0
- data/spec/models/atrium/collection_spec.rb +76 -0
- data/spec/models/atrium/configuration_spec.rb +114 -0
- data/spec/models/atrium/description_spec.rb +56 -0
- data/spec/models/atrium/essay_spec.rb +16 -0
- data/spec/models/atrium/exhibit_spec.rb +90 -0
- data/spec/models/atrium/search/facet_selection_spec.rb +23 -0
- data/{test_support/spec → spec}/models/atrium/search/facet_spec.rb +2 -4
- data/{test_support/spec → spec}/models/atrium/showcase/facet_selection_spec.rb +5 -5
- data/spec/models/atrium/showcase/featured_selection_spec.rb +18 -0
- data/spec/models/atrium/showcase_spec.rb +97 -0
- data/spec/services/browse_level_evaluation_service_spec.rb +33 -0
- data/spec/services/current_filter_query_params_extraction_service_spec.rb +34 -0
- data/spec/services/navigation_tree_spec.rb +18 -0
- data/spec/services/params_adaptor_for_filter_spec.rb +8 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/support/accept_nested_attributes_for.rb +39 -0
- data/{test_support/spec → spec}/support/be_accessible_matcher.rb +0 -0
- data/{test_support/spec → spec}/support/be_routed_mixin.rb +0 -0
- data/spec/support/controller_hacks.rb +35 -0
- data/spec/support/routes.rb +5 -0
- data/spec/support/shared_examples/is_showcased_mixin.rb +20 -0
- data/spec/support/shared_examples/query_param_mixin.rb +179 -0
- data/{app/assets/stylesheets/atrium → vendor/assets/images}/chosen-sprite.png +0 -0
- data/{app → vendor}/assets/javascripts/chosen.jquery.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor.warning.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/config.js.coffee +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/jquery.generateId.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/jquery.jeditable.ckeditor.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/linkItem/application_link.png +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/linkItem/dialogs/linkItem.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/linkItem/plugin.js +0 -0
- data/{app → vendor}/assets/javascripts/ckeditor/plugins/linkItem/ui_toolbar_pencil.png +0 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.23.custom.min.js +41 -0
- data/vendor/assets/javascripts/jquery-ui-build.txt +8 -0
- data/{app → vendor}/assets/javascripts/jquery.jeditable.js +0 -0
- data/{app/assets/stylesheets/atrium → vendor/assets/stylesheets}/chosen.css +4 -4
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/stylesheets/ui-lightness/jquery-ui-1.8.23.custom.css +334 -0
- metadata +431 -949
- data/GETTING_STARTED.textile +0 -102
- data/app/assets/images/atrium/ajax-loader.gif +0 -0
- data/app/assets/images/atrium/lightbox-ico-loading.gif +0 -0
- data/app/assets/images/atrium/logo.png +0 -0
- data/app/assets/javascripts/jquery.colorbox.js +0 -864
- data/app/assets/stylesheets/colorbox.css +0 -42
- data/app/assets/stylesheets/controls.png +0 -0
- data/app/assets/stylesheets/loading.gif +0 -0
- data/app/controllers/atrium/base_controller.rb +0 -25
- data/app/controllers/atrium/collection_exhibit_order_controller.rb +0 -21
- data/app/controllers/atrium/customization_controller.rb +0 -41
- data/app/controllers/atrium/exhibit_facet_order_controller.rb +0 -19
- data/app/helpers/atrium/base_helper.rb +0 -6
- data/app/models/ability.rb +0 -14
- data/app/models/atrium/showcase/item.rb +0 -19
- data/app/models/role_mapper.rb +0 -23
- data/app/views/_user_util_links.html.erb +0 -25
- data/app/views/atrium/collections/_bookmark_control.html.erb +0 -25
- data/app/views/atrium/collections/_browse_index.html.erb +0 -20
- data/app/views/atrium/collections/_collection_items_index.html.erb +0 -10
- data/app/views/atrium/collections/_document.html.erb +0 -24
- data/app/views/atrium/collections/_document_list.html.erb +0 -6
- data/app/views/atrium/collections/_edit_navigation.html.erb +0 -20
- data/app/views/atrium/collections/_folder_control.html.erb +0 -12
- data/app/views/atrium/collections/_listing.html.erb +0 -18
- data/app/views/atrium/collections/_navigation.html.erb +0 -50
- data/app/views/atrium/collections/_results_pagination.html.erb +0 -9
- data/app/views/atrium/collections/_sort_and_per_page.html.erb +0 -23
- data/app/views/atrium/exhibits/_bookmark_control.html.erb +0 -25
- data/app/views/atrium/exhibits/_folder_control.html.erb +0 -12
- data/app/views/atrium/exhibits/_navigation.html.erb +0 -30
- data/app/views/atrium/showcases/_showcase_navigation.html.erb +0 -23
- data/app/views/catalog/_collection_home_text.html.erb +0 -6
- data/app/views/catalog/_constraints.html.erb +0 -9
- data/app/views/catalog/_default_collection_text.html.erb +0 -18
- data/app/views/catalog/_default_home_text.html.erb +0 -6
- data/app/views/catalog/_home_text.html.erb +0 -6
- data/app/views/catalog/_index_partials/_description.html.erb +0 -8
- data/app/views/catalog/_search_form.html.erb +0 -66
- data/app/views/catalog/_show_partials/_description.html.erb +0 -15
- data/app/views/catalog/browse_show.html.erb +0 -18
- data/app/views/catalog/index.html.erb +0 -41
- data/app/views/catalog/list_description.html.erb +0 -24
- data/app/views/catalog/list_item.html.erb +0 -3
- data/app/views/layouts/atrium_themes/default.html.erb +0 -4
- data/app/views/layouts/item_listing.html.erb +0 -36
- data/app/views/listing/_document.html.erb +0 -27
- data/app/views/listing/_document_list.html.erb +0 -3
- data/app/views/listing/_item_search.html.erb +0 -27
- data/app/views/shared/_banner.html.erb +0 -5
- data/app/views/shared/_collection_complete_list.html.erb +0 -33
- data/app/views/shared/_collection_search_form.html.erb +0 -12
- data/app/views/shared/_collection_title_header.html.erb +0 -3
- data/app/views/shared/_featured_sources.html.erb +0 -23
- data/app/views/shared/_list_descriptions.html.erb +0 -39
- data/app/views/shared/_navigation_browse_levels.html.erb +0 -34
- data/app/views/shared/_showcase_configure_menu.html.erb +0 -22
- data/app/views/shared/_top_navigation.html.erb +0 -9
- data/init.rb +0 -3
- data/lib/application_controller.rb +0 -24
- data/lib/atrium/application_helper.rb +0 -24
- data/lib/atrium/atrium_helper_behavior.rb +0 -159
- data/lib/atrium/catalog.rb +0 -203
- data/lib/atrium/collections_helper.rb +0 -172
- data/lib/atrium/controller.rb +0 -10
- data/lib/atrium/descriptions_helper.rb +0 -27
- data/lib/atrium/layout_helper.rb +0 -13
- data/lib/atrium/routes.rb +0 -100
- data/lib/atrium/solr_helper.rb +0 -440
- data/lib/generators/atrium/assets_generator.rb +0 -44
- data/lib/generators/atrium/atrium_generator.rb +0 -149
- data/lib/generators/atrium/cucumber_support_generator.rb +0 -29
- data/lib/generators/atrium/templates/config/role_map_cucumber.yml +0 -2
- data/lib/generators/atrium/templates/config/role_map_development.yml +0 -2
- data/lib/generators/atrium/templates/config/role_map_production.yml +0 -2
- data/lib/generators/atrium/templates/config/role_map_test.yml +0 -2
- data/lib/generators/atrium/templates/config/solr.yml +0 -10
- data/lib/generators/atrium/templates/db/seeds.rb +0 -87
- data/lib/generators/atrium/templates/migrations/create_atrium_showcase_items.rb +0 -17
- data/lib/generators/atrium/templates/themes/example.html.erb +0 -21
- data/lib/railties/all_tests.rake +0 -23
- data/lib/railties/atrium_cucumber.rake +0 -121
- data/lib/railties/index.rake +0 -37
- data/tasks/atrium.rake +0 -268
- data/tasks/atrium_rspec.rake +0 -91
- data/test_support/etc/Gemfile +0 -33
- data/test_support/etc/bundle_config +0 -3
- data/test_support/etc/rvmrc +0 -32
- data/test_support/features/atrium_collections.feature +0 -162
- data/test_support/features/atrium_exhibits.feature +0 -164
- data/test_support/features/step_definitions/atrium_collection_steps.rb +0 -102
- data/test_support/features/step_definitions/atrium_exhibit_steps.rb +0 -53
- data/test_support/features/step_definitions/bookmarks_steps.rb +0 -6
- data/test_support/features/step_definitions/error_steps.rb +0 -5
- data/test_support/features/step_definitions/folder_steps.rb +0 -27
- data/test_support/features/step_definitions/general_steps.rb +0 -50
- data/test_support/features/step_definitions/record_view_steps.rb +0 -12
- data/test_support/features/step_definitions/saved_searches_steps.rb +0 -22
- data/test_support/features/step_definitions/search_facets_steps.rb +0 -29
- data/test_support/features/step_definitions/search_history_steps.rb +0 -9
- data/test_support/features/step_definitions/search_result_steps.rb +0 -114
- data/test_support/features/step_definitions/search_steps.rb +0 -103
- data/test_support/features/step_definitions/user_steps.rb +0 -5
- data/test_support/features/step_definitions/web_steps.rb +0 -213
- data/test_support/features/support/env.rb +0 -67
- data/test_support/features/support/paths.rb +0 -76
- data/test_support/features/support/selectors.rb +0 -40
- data/test_support/fixtures/atrium_exhibits.yml +0 -3
- data/test_support/spec/controllers/atrium/base_controller_spec.rb +0 -13
- data/test_support/spec/controllers/atrium/collection_exhibit_order_controller_spec.rb +0 -29
- data/test_support/spec/controllers/atrium/collections_controller_spec.rb +0 -185
- data/test_support/spec/controllers/atrium/customization_controller_spec.rb +0 -38
- data/test_support/spec/controllers/atrium/descriptions_controller_spec.rb +0 -150
- data/test_support/spec/controllers/atrium/exhibit_facet_order_controller_spec.rb +0 -36
- data/test_support/spec/controllers/atrium/exhibits_controller_spec.rb +0 -192
- data/test_support/spec/controllers/atrium/showcases_controller_spec.rb +0 -219
- data/test_support/spec/helpers/atrium_collections_helper_spec.rb +0 -147
- data/test_support/spec/helpers/atrium_description_helper_spec.rb +0 -47
- data/test_support/spec/helpers/atrium_solr_helper_spec.rb +0 -522
- data/test_support/spec/models/atrium/browse_level_spec.rb +0 -31
- data/test_support/spec/models/atrium/collection_spec.rb +0 -30
- data/test_support/spec/models/atrium/description_spec.rb +0 -67
- data/test_support/spec/models/atrium/essay_spec.rb +0 -12
- data/test_support/spec/models/atrium/exhibit_spec.rb +0 -76
- data/test_support/spec/models/atrium/search/facet_selection_spec.rb +0 -24
- data/test_support/spec/models/atrium/search_facet_spec.rb +0 -54
- data/test_support/spec/models/atrium/showcase/item_spec.rb +0 -12
- data/test_support/spec/models/atrium/showcase_facet_selection_spec.rb +0 -65
- data/test_support/spec/models/atrium/showcase_spec.rb +0 -134
- data/test_support/spec/rcov.opts +0 -3
- data/test_support/spec/routing/atrium/collections_routing_spec.rb +0 -33
- data/test_support/spec/spec.opts +0 -4
- data/test_support/spec/spec_helper.rb +0 -47
- data/test_support/tmp/step_definitions/catalog_index_steps.rb +0 -14
- data/test_support/tmp/step_definitions/edit_document_steps.rb +0 -67
- data/test_support/tmp/step_definitions/hydra_metadata_steps.rb +0 -3
- data/test_support/tmp/step_definitions/hydra_steps.rb +0 -8
- data/test_support/tmp/step_definitions/search_steps.rb +0 -86
- data/test_support/tmp/step_definitions/searching_steps.rb +0 -22
- data/test_support/tmp/step_definitions/select_steps.rb +0 -8
- data/test_support/tmp/step_definitions/show_document_steps.rb +0 -73
- data/test_support/tmp/step_definitions/user_steps.rb +0 -15
- data/test_support/tmp/step_definitions/web_steps.rb +0 -273
- data/test_support/tmp/support/env.rb +0 -54
- data/test_support/tmp/support/paths.rb +0 -57
@@ -1,147 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe Atrium::CollectionsHelper do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@collection = Atrium::Collection.new
|
7
|
-
end
|
8
|
-
|
9
|
-
after(:each) do
|
10
|
-
begin
|
11
|
-
@collection.delete
|
12
|
-
rescue
|
13
|
-
end
|
14
|
-
end
|
15
|
-
describe "get_collections_list" do
|
16
|
-
it "should call find with all on Atrium::Collection class" do
|
17
|
-
Atrium::Collection.expects(:find).with(:all)
|
18
|
-
helper.get_collections_list
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "edit_collection_link" do
|
23
|
-
it "should return properly formatted edit collection link" do
|
24
|
-
helper.stubs(:params).returns({:controller=>"atrium_collections", :id=>"my_collection_id"})
|
25
|
-
helper.edit_collection_link.should == "/atrium/collections/my_collection_id/edit?render_search=false"
|
26
|
-
helper.stubs(:params).returns({:collection_id=>"my_collection_id"})
|
27
|
-
helper.edit_collection_link.should == "/atrium/collections/my_collection_id/edit?render_search=false"
|
28
|
-
helper.edit_collection_link("my_class").should == "/atrium/collections/my_collection_id/edit?class=my_class&render_search=false"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "browse_collection_link" do
|
33
|
-
it "should return properly formatted browse collection link" do
|
34
|
-
helper.stubs(:params).returns({:controller=>"atrium_collections",:id=>"my_collection_id"})
|
35
|
-
helper.browse_collection_link.should == "/atrium/collections/my_collection_id"
|
36
|
-
helper.stubs(:params).returns({:collection_id=>"my_collection_id"})
|
37
|
-
helper.browse_collection_link.should == "/atrium/collections/my_collection_id"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "add_browse_facet_params" do
|
42
|
-
it "should return a params hash with a field pointing to an array with the new value" do
|
43
|
-
p = HashWithIndifferentAccess.new
|
44
|
-
helper.add_browse_facet_params(:test, "testing", p).should == {"f"=>{"test"=>["testing"]}}
|
45
|
-
#test if p is nil
|
46
|
-
helper.add_browse_facet_params(:test, "testing").should == {"f"=>{"test"=>["testing"]}}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "get_browse_facet_path" do
|
51
|
-
before do
|
52
|
-
catalog_facet_params = HashWithIndifferentAccess.new({:q => "query",
|
53
|
-
:search_field => "search_field",
|
54
|
-
:f => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2", "value2a"]},
|
55
|
-
:exhibit_id => 'exhibit_PID',
|
56
|
-
:collection_id => 'collection_PID',
|
57
|
-
:controller => "catalog"
|
58
|
-
})
|
59
|
-
helper.stubs(:params).returns(catalog_facet_params)
|
60
|
-
end
|
61
|
-
it "should redirect to exhibit action" do
|
62
|
-
response = CGI::unescape(helper.get_browse_facet_path("facet_solr_field", "item_value", ["facet_field_1","facet_field_2"], "exhibit_number", "exhibit_id"))
|
63
|
-
response.should == "/atrium/exhibits/exhibit_id?class=browse_facet_select&collection_id=collection_PID&f[facet_field_1][]=value1&f[facet_field_2][]=value2&f[facet_field_2][]=value2a&f[facet_solr_field][]=item_value"
|
64
|
-
end
|
65
|
-
|
66
|
-
it "if an item is selected and generating a path for alternate selection at the same level then the path should not include any child facet selections that may exist" do
|
67
|
-
catalog_facet_params = {:q => "query",
|
68
|
-
:search_field => "search_field",
|
69
|
-
:f => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2a"]},
|
70
|
-
:exhibit_id => 'exhibit_PID',
|
71
|
-
:collection_id => 'collection_PID',
|
72
|
-
:controller => "catalog"
|
73
|
-
}
|
74
|
-
helper.stubs(:params).returns(catalog_facet_params)
|
75
|
-
# browse level data to work with.....
|
76
|
-
# browse_level_data = [{:solr_facet_name=>"facet_field_1",:label=>"my_label",:selected=>"value1",:values=>["value1","value1a","value1b"]},
|
77
|
-
# {:solr_facet_name=>"facet_field_2",:label=>"my_label2",:selected=>"value2a",:values=>["value2","value2a"]}]
|
78
|
-
#test making link for something not currently selected that should have child facet selection removed
|
79
|
-
browse_facets = ["facet_field_1","facet_field_2"]
|
80
|
-
response = CGI::unescape(helper.get_browse_facet_path("facet_field_1","value1a",browse_facets,"exhibit_number", "exhibit_id"))
|
81
|
-
response.should == "/atrium/exhibits/exhibit_id?class=browse_facet_select&collection_id=collection_PID&f[facet_field_1][]=value1a"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "get_selected_browse_facet_path" do
|
86
|
-
before do
|
87
|
-
@catalog_facet_params = {
|
88
|
-
:f => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2", "value2a"]},
|
89
|
-
:id => 'exhibit_PID',
|
90
|
-
:controller => "atrium/exhibits",
|
91
|
-
:collection_id => 'collection_PID',
|
92
|
-
:action=>"show"
|
93
|
-
}
|
94
|
-
helper.stubs(:params).returns(@catalog_facet_params)
|
95
|
-
end
|
96
|
-
it "should redirect to exhibit action" do
|
97
|
-
helper.stubs(:params).returns(@catalog_facet_params)
|
98
|
-
item = {"facet_field" => ["facet_value"]}
|
99
|
-
item.stubs(:value).returns(["value1"])
|
100
|
-
#helper.stubs(:remove_facet_params).returns({"f" => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2", "value2a"]},
|
101
|
-
# "id" => 'collection_PID',
|
102
|
-
# "controller" => "atrium/collections"
|
103
|
-
#})
|
104
|
-
response = CGI::unescape(helper.get_selected_browse_facet_path("facet_field_1", item, ["facet_field_1", "browse_facet"],"exhibit_number", "exhibit_id"))
|
105
|
-
#all browse facets should be removed since at the top, and the only current facet in the params is facet_field_1, so facet_field_2 stays
|
106
|
-
response.should == "/atrium/exhibits/exhibit_id?collection_id=collection_PID&f[facet_field_2][]=value2&f[facet_field_2][]=value2a"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "get_selected_browse_facets" do
|
111
|
-
before do
|
112
|
-
@catalog_facet_params = {
|
113
|
-
:f => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2", "value2a"]},
|
114
|
-
:id => 'exhibit_PID',
|
115
|
-
:controller => "atrium/exhibits",
|
116
|
-
:action=>"show"
|
117
|
-
}
|
118
|
-
helper.stubs(:params).returns(@catalog_facet_params)
|
119
|
-
end
|
120
|
-
it "should return a hash of selected facet mapped to value not in array" do
|
121
|
-
browse_facets = ["facet_field_1","facet_field_2","facet_field_3"]
|
122
|
-
helper.get_selected_browse_facets(browse_facets).should == {:facet_field_1=>"value1",:facet_field_2=>"value2"}
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe "remove_related_facet_params" do
|
127
|
-
before(:each) do
|
128
|
-
@params = {
|
129
|
-
:f => {:facet_field_1 => ["value1"], :facet_field_2 => ["value2"], :facet_field_4=>["value4"]}
|
130
|
-
}
|
131
|
-
@browse_facets = [:facet_field_1,:facet_field_2,:facet_field_3]
|
132
|
-
helper.stubs(:params).returns(@params)
|
133
|
-
end
|
134
|
-
it "should return a params hash with a selected facet field removed" do
|
135
|
-
helper.remove_related_facet_params(:facet_field_2,@params,@browse_facets,"1").should == {:f=>{:facet_field_1 => ["value1"],:facet_field_4=>["value4"]}}
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should remove any lower selected facets if parent facet is removed" do
|
139
|
-
helper.remove_related_facet_params(:facet_field_1,@params,@browse_facets,"1").should == {:f=>{:facet_field_4=>["value4"]}}
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should ignore one that is not a browse facet" do
|
143
|
-
helper.remove_related_facet_params(:facet_field_4,@params,@browse_facets,"1").should == {:f=>{:facet_field_1 => ["value1"], :facet_field_2 => ["value2"], :facet_field_4=>["value4"]}}
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
Blacklight::SolrHelper.stubs(:class_inheritable_accessor)
|
4
|
-
include Blacklight::SolrHelper
|
5
|
-
|
6
|
-
describe Atrium::DescriptionsHelper do
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@collection = Atrium::Collection.new
|
10
|
-
@collection.save
|
11
|
-
@collection_showcase = Atrium::Showcase.new(:showcases_id=>@collection.id, :showcases_type=>@collection.class.name)
|
12
|
-
@collection_showcase.save
|
13
|
-
@exhibit = Atrium::Exhibit.new
|
14
|
-
@exhibit_showcase = Atrium::Showcase.new(:showcases_id=>@exhibit.id, :showcases_type=>@exhibit.class.name)
|
15
|
-
@exhibit_showcase.save
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
after(:each) do
|
20
|
-
begin
|
21
|
-
@collection.delete
|
22
|
-
@collection_showcase.delete
|
23
|
-
rescue
|
24
|
-
end
|
25
|
-
begin
|
26
|
-
@exhibit.delete
|
27
|
-
@exhibit_showcase.delete
|
28
|
-
rescue
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "get_description_for_showcase" do
|
33
|
-
it "return description hash from solr for any given collection" do
|
34
|
-
helper.stubs(:showcase).returns(@collection_showcase)
|
35
|
-
description_hash=helper.get_description_for_showcase(@collection_showcase)
|
36
|
-
description_hash.size.should == 0
|
37
|
-
end
|
38
|
-
|
39
|
-
it "returns description details from solr for given showcase" do
|
40
|
-
@description = Atrium::Description.new(:atrium_showcase_id=>@collection_showcase.id)
|
41
|
-
@description.save!
|
42
|
-
@description.update_attributes({:description_solr_id=>"RBSC-CURRENCY:715"})
|
43
|
-
helper.expects(:get_solr_response_for_field_values).with("id",["RBSC-CURRENCY:715"]).returns([[:docs => ["id"=>"RBSC-CURRENCY:715", "title_t"=>["title"],"description_content_s"=>["description content"]]],["id"=>"RBSC-CURRENCY:715", "title_t"=>["title"],"description_content_s"=>["description content"]]])
|
44
|
-
helper.get_description_for_showcase(@collection_showcase)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,522 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
Blacklight::SolrHelper.stubs(:class_inheritable_accessor)
|
4
|
-
include Blacklight::SolrHelper
|
5
|
-
include Atrium::SolrHelper
|
6
|
-
|
7
|
-
describe Atrium::SolrHelper do
|
8
|
-
|
9
|
-
def blacklight_config
|
10
|
-
@config = Blacklight::Configuration.new.configure do |config|
|
11
|
-
config.default_solr_params = {
|
12
|
-
:qt => 'search',
|
13
|
-
:rows => 10
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
before(:each) do
|
19
|
-
@collection = Atrium::Collection.new
|
20
|
-
@collection.save
|
21
|
-
end
|
22
|
-
|
23
|
-
after(:each) do
|
24
|
-
begin
|
25
|
-
@collection.delete
|
26
|
-
rescue
|
27
|
-
end
|
28
|
-
begin
|
29
|
-
@exhibit.delete
|
30
|
-
rescue
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "initialize_collection" do
|
35
|
-
before(:each) do
|
36
|
-
helper.stubs(:get_all_children).returns([])
|
37
|
-
end
|
38
|
-
it "atrium_collection should be nil if both :id (if atrium_collections controller) and :collection_id not in params" do
|
39
|
-
helper.stubs(:params).returns({:id=>"test_id"})
|
40
|
-
helper.__initialize_collection(nil)
|
41
|
-
helper.atrium_collection.should == nil
|
42
|
-
#helper.stubs(:params).returns({:controller=>"atrium_collections",:collection_id=>"test_id"})
|
43
|
-
#helper.atrium_collection.should == nil
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should raise an exception if the collection_id passed in does not exist" do
|
47
|
-
helper.expects(:params).returns({:id=>"test_id",:controller=>"atrium_collections"})
|
48
|
-
#these only get called once if an collection is found
|
49
|
-
helper.expects(:build_lucene_query).returns("_query_:id\:test_id")
|
50
|
-
helper.expects(:get_search_results)
|
51
|
-
@collection.save!
|
52
|
-
logger.expects(:error).twice
|
53
|
-
helper.__initialize_collection("test_id")
|
54
|
-
#check valid case as well
|
55
|
-
helper.expects(:params).returns({:id=>@collection.id,:controller=>"atrium_collections"})
|
56
|
-
helper.__initialize_collection(@collection.id)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should configure params correctly if facet selected and facet in filter" do
|
60
|
-
helper.stubs(:params).returns({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}})
|
61
|
-
@collection.filter_query_params = {:q=>"testing",:f=>{"season"=>["spring"]}}
|
62
|
-
Atrium::Collection.expects(:find).with("test_id").returns(@collection)
|
63
|
-
helper.expects(:solr_search_params).with(@collection.filter_query_params).returns(:q=>"testing",:fq=>["{!raw f=season_facet}Spring"]).at_least_once
|
64
|
-
helper.expects(:solr_search_params).with({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}}).returns(:fq=>["{!raw f=continent}North America"])
|
65
|
-
#it will combine param facet and filter facet into extra params so that the params facets are not overwritten when the filter facet is applied
|
66
|
-
extra_params = {:q=>"testing", :fq=>["{!raw f=continent}North America","{!raw f=season_facet}Spring"]}
|
67
|
-
helper.expects(:get_search_results).with({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}},extra_params)
|
68
|
-
helper.__initialize_collection("test_id")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should configure params correctly if facet selected and no facet in filter" do
|
72
|
-
helper.stubs(:params).returns({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}})
|
73
|
-
@collection.filter_query_params = {:q=>"testing"}
|
74
|
-
Atrium::Collection.expects(:find).with("test_id").returns(@collection)
|
75
|
-
helper.expects(:prepare_extra_controller_params_for_collection_query).returns(:q=>"testing")
|
76
|
-
helper.expects(:reset_extra_controller_params_after_collection_query).returns(:fq=>["{!raw f=continent}North America"])
|
77
|
-
#it will combine param facet and filter facet into extra params so that the params facets are not overwritten when the filter facet is applied
|
78
|
-
extra_params = {:q=>"testing"}
|
79
|
-
helper.expects(:get_search_results).with({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}},extra_params)
|
80
|
-
helper.__initialize_collection("test_id")
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should configure params correctly if facet selected with same facet in filter" do
|
84
|
-
helper.stubs(:params).returns({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}})
|
85
|
-
@collection.filter_query_params = {:q=>"testing",:f=>{"continent"=>["North America"]}}
|
86
|
-
Atrium::Collection.expects(:find).with("test_id").returns(@collection)
|
87
|
-
helper.expects(:prepare_extra_controller_params_for_collection_query).returns(:q=>"testing",:fq=>["{!raw f=continent}North America"])
|
88
|
-
helper.expects(:reset_extra_controller_params_after_collection_query).returns(:fq=>["{!raw f=continent}North America"])
|
89
|
-
#it will combine param facet and filter facet into extra params so that the params facets are not overwritten when the filter facet is applied
|
90
|
-
extra_params = {:q=>"testing", :fq=>["{!raw f=continent}North America"]}
|
91
|
-
helper.expects(:get_search_results).with({:collection_id=>"test_id",:f=>{"continent"=>["North America"]}},extra_params)
|
92
|
-
helper.__initialize_collection("test_id")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "get_exhibit_navigation_data" do
|
97
|
-
it "if atrium collection still nil after calling initialize collection than should return empty array" do
|
98
|
-
helper.expects(:initialize_collection).returns(nil)
|
99
|
-
helper.expects(:params).returns({:collection_id=>"test_id"})
|
100
|
-
Atrium::Collection.expects(:find).with("test_id").returns(nil)
|
101
|
-
helper.expects(:get_browse_level_data).returns([])
|
102
|
-
helper.get_exhibit_navigation_data.should == []
|
103
|
-
end
|
104
|
-
|
105
|
-
it "if no atrium collection exhibits it should return an empty array" do
|
106
|
-
collection = mock()
|
107
|
-
collection.stubs(:exhibits).returns([])
|
108
|
-
helper.stubs(:atrium_collection).returns(collection)
|
109
|
-
helper.stubs(:check_for_scope).returns(false)
|
110
|
-
helper.get_exhibit_navigation_data.should == []
|
111
|
-
end
|
112
|
-
|
113
|
-
it "if atrium collection is not nil and has exhibits it should call get browse level data for each browse set" do
|
114
|
-
collection = Atrium::Collection.new
|
115
|
-
collection.save
|
116
|
-
collection.stubs(:exhibits).returns([])
|
117
|
-
helper.stubs(:atrium_collection).returns(collection)
|
118
|
-
exhibit1 = Atrium::Exhibit.new({:atrium_collection_id=>collection.id,:set_number=>1})
|
119
|
-
exhibit1.save
|
120
|
-
exhibit2 = Atrium::Exhibit.new({:atrium_collection_id=>collection.id,:set_number=>2})
|
121
|
-
exhibit2.save
|
122
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>exhibit1.id,:solr_facet_name=>"my_facet",:label=>"my_label"})
|
123
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>exhibit2.id,:solr_facet_name=>"my_facet2",:label=>"my_label2"})
|
124
|
-
browse_level3 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>exhibit2.id,:solr_facet_name=>"my_facet3",:label=>"my_label3"})
|
125
|
-
exhibit1.stubs(:browse_levels).returns([browse_level1])
|
126
|
-
exhibit2.stubs(:browse_levels).returns([browse_level2,browse_level3])
|
127
|
-
collection.expects(:exhibits).returns([exhibit1,exhibit2]).at_least_once
|
128
|
-
browse_response = mock()
|
129
|
-
helper.stubs(:browse_response).returns(browse_response)
|
130
|
-
extra_con_params = mock()
|
131
|
-
helper.stubs(:current_extra_controller_params).returns(extra_con_params)
|
132
|
-
updated_browse_level1 = browse_level1.clone
|
133
|
-
updated_browse_level1.expects(:values).returns(["test1","test2"])
|
134
|
-
updated_browse_level1.expects(:selected).returns("test1")
|
135
|
-
updated_browse_level2 = browse_level2.clone
|
136
|
-
updated_browse_level2.expects(:values).returns(["test3","test4"])
|
137
|
-
helper.expects(:get_browse_level_data).with(collection,exhibit1,[browse_level1],browse_response,extra_con_params,true).returns([updated_browse_level1])
|
138
|
-
helper.expects(:get_browse_level_data).with(collection,exhibit2,[browse_level2,browse_level3],browse_response,extra_con_params,true).returns([updated_browse_level2,browse_level3])
|
139
|
-
#check that the array returned is flattened appropriately on concat
|
140
|
-
browse_data = helper.get_exhibit_navigation_data
|
141
|
-
browse_data.size.should == 2
|
142
|
-
#order is important here for both browse sets and esp. nested levels
|
143
|
-
browse_data.first.should == exhibit1
|
144
|
-
browse_data.second.should == exhibit2
|
145
|
-
browse_data.first.browse_levels.first.values.should == ["test1","test2"]
|
146
|
-
browse_data.first.browse_levels.first.selected.should == "test1"
|
147
|
-
browse_data.second.browse_levels.first.values.should == ["test3","test4"]
|
148
|
-
browse_data.second.browse_levels.first.selected.should == nil
|
149
|
-
#for the other browse level of the second browse set values should be empty since nothing selected in parent
|
150
|
-
browse_data.second.browse_levels.second.values.should == []
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
describe "get_browse_level_data" do
|
155
|
-
it "should return an array of exhibit objects with browse levels objects sorted by level number if any defined" do
|
156
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
157
|
-
@exhibit.save
|
158
|
-
@exhibit2 = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>2})
|
159
|
-
@exhibit2.save
|
160
|
-
helper.expects(:facet_field_labels).returns("my_label").times(3)
|
161
|
-
#label will be nil
|
162
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet", :level_number=>1})
|
163
|
-
browse_level1.save
|
164
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet2", :level_number=>2})
|
165
|
-
browse_level2.save
|
166
|
-
@exhibit.stubs(:browse_levels).returns([browse_level1,browse_level2])
|
167
|
-
browse_level3 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit2.id,:solr_facet_name=>"my_facet2", :level_number=>1})
|
168
|
-
browse_level3.save
|
169
|
-
browse_level4 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit2.id,:solr_facet_name=>"my_facet3", :level_number=>2})
|
170
|
-
browse_level4.save
|
171
|
-
@exhibit2.stubs(:browse_levels).returns([browse_level3,browse_level4])
|
172
|
-
@collection.expects(:exhibits).returns([@exhibit,@exhibit2]).at_least_once
|
173
|
-
helper.expects(:atrium_collection).returns(@collection).at_least_once
|
174
|
-
|
175
|
-
browse_response = mock()
|
176
|
-
facet1 = mock()
|
177
|
-
facet2 = mock()
|
178
|
-
facet3 = mock()
|
179
|
-
item1 = mock()
|
180
|
-
item2 = mock()
|
181
|
-
item3 = mock()
|
182
|
-
item4 = mock()
|
183
|
-
item5 = mock()
|
184
|
-
|
185
|
-
item1.expects(:value).returns("val1").at_least_once
|
186
|
-
item2.expects(:value).returns("val2").at_least_once
|
187
|
-
item3.expects(:value).returns("val3").at_least_once
|
188
|
-
item4.expects(:value).returns("val4").at_least_once
|
189
|
-
item5.expects(:value).returns("val5").at_least_once
|
190
|
-
|
191
|
-
facet1.expects(:items).returns([item1,item2]).at_least_once
|
192
|
-
facet1.expects(:name).returns("my_facet").at_least_once
|
193
|
-
facet2.expects(:items).returns([item3,item4,item5]).at_least_once
|
194
|
-
facet2.expects(:name).returns("my_facet2").at_least_once
|
195
|
-
browse_response.expects(:facets).returns([facet1,facet2,facet3]).at_least_once
|
196
|
-
helper.stubs(:browse_response).returns(browse_response)
|
197
|
-
helper.expects(:facet_in_params?).returns(false).at_least_once
|
198
|
-
#this will make it have something be selected
|
199
|
-
helper.expects(:facet_in_params?).with('my_facet','val2').returns(true)
|
200
|
-
helper.stubs(:get_search_results).returns([browse_response,mock()])
|
201
|
-
|
202
|
-
browse_data = helper.get_exhibit_navigation_data
|
203
|
-
browse_data.size.should == 2
|
204
|
-
browse_data.first.should == @exhibit
|
205
|
-
browse_data.second.should == @exhibit2
|
206
|
-
|
207
|
-
browse_data.first.browse_levels.first.should == browse_level1
|
208
|
-
browse_data.first.browse_levels.second.should == browse_level2
|
209
|
-
browse_data.second.browse_levels.first.should == browse_level3
|
210
|
-
browse_data.second.browse_levels.second.should == browse_level4
|
211
|
-
|
212
|
-
browse_data.first.browse_levels.first.values.should == ["val1","val2"]
|
213
|
-
browse_data.first.browse_levels.second.values.should == ["val3","val4","val5"]
|
214
|
-
browse_data.second.browse_levels.first.values.should == ["val3","val4","val5"]
|
215
|
-
browse_data.second.browse_levels.second.values.should == []
|
216
|
-
|
217
|
-
browse_data.first.browse_levels.first.selected.should == "val2"
|
218
|
-
browse_data.first.browse_levels.second.selected.should == nil
|
219
|
-
browse_data.second.browse_levels.first.selected.should == nil
|
220
|
-
browse_data.second.browse_levels.second.selected.should == nil
|
221
|
-
end
|
222
|
-
|
223
|
-
it "should use the blacklight facet field label if no label defined in a browse level" do
|
224
|
-
#must have a browse set and collection not nil
|
225
|
-
@collection.save
|
226
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
227
|
-
@exhibit.save
|
228
|
-
#add a browse level with label nil
|
229
|
-
browse_level = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:level_number=>1})
|
230
|
-
@exhibit.expects(:browse_levels).returns([browse_level]).at_least_once
|
231
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
232
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
233
|
-
helper.expects(:facet_field_labels).returns({"my_facet"=>"my_label"}).times(2)
|
234
|
-
#response must have facet for this level
|
235
|
-
response = mock()
|
236
|
-
facet = mock()
|
237
|
-
facet.expects(:name).returns("my_facet").times(4)
|
238
|
-
#no items in facet to skip calling get_browse_set_data
|
239
|
-
facet.expects(:items).returns([]).twice
|
240
|
-
response.expects(:facets).returns([facet]).times(4)
|
241
|
-
helper.stubs(:browse_response).returns(response)
|
242
|
-
helper.stubs(:get_search_results).returns([response,mock()])
|
243
|
-
browse_data = helper.get_exhibit_navigation_data
|
244
|
-
browse_data.first.browse_levels.first.label.should == "my_label"
|
245
|
-
#check if label is blank instead
|
246
|
-
browse_level.label = ""
|
247
|
-
browse_data = helper.get_exhibit_navigation_data
|
248
|
-
browse_data.first.browse_levels.first.label.should == "my_label"
|
249
|
-
end
|
250
|
-
|
251
|
-
it "should use the label in a browse level if defined" do
|
252
|
-
helper.expects(:facet_field_labels).returns("my_label").times(0)
|
253
|
-
#must have a browse set and collection not nil
|
254
|
-
@collection.save
|
255
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
256
|
-
@exhibit.save
|
257
|
-
browse_level = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:label=>"my_label_2"})
|
258
|
-
@exhibit.expects(:browse_levels).returns([browse_level]).at_least_once
|
259
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
260
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
261
|
-
response = mock()
|
262
|
-
facet = mock()
|
263
|
-
facet.expects(:items).returns([]).at_least_once
|
264
|
-
facet.expects(:name).returns("my_facet").at_least_once
|
265
|
-
response.expects(:facets).returns([facet]).at_least_once
|
266
|
-
helper.stubs(:browse_response).returns(response)
|
267
|
-
helper.stubs(:get_search_results).returns([response,mock()])
|
268
|
-
helper.get_exhibit_navigation_data.first.browse_levels.first.label.should == "my_label_2"
|
269
|
-
end
|
270
|
-
|
271
|
-
it "if no f param is defined it should set the response without f param to be response" do
|
272
|
-
#if they are the same then response.facets should be called twice
|
273
|
-
@collection.save
|
274
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
275
|
-
@exhibit.save
|
276
|
-
browse_level = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:label=>"my_label"})
|
277
|
-
@exhibit.expects(:browse_levels).returns([browse_level]).at_least_once
|
278
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
279
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
280
|
-
response = mock()
|
281
|
-
facet = mock()
|
282
|
-
facet.expects(:name).returns("other_facet").at_least_once
|
283
|
-
#it will call this twice if response is same for without f param
|
284
|
-
response.expects(:facets).returns([facet]).twice
|
285
|
-
helper.stubs(:browse_response).returns(response)
|
286
|
-
helper.stubs(:get_search_results).returns([response,mock()])
|
287
|
-
helper.get_exhibit_navigation_data
|
288
|
-
end
|
289
|
-
|
290
|
-
it "if multiple browse levels defined and f defined for anything but top level it should only have values set for the top level" do
|
291
|
-
#must have a browse set and collection not nil
|
292
|
-
@collection.save
|
293
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
294
|
-
@exhibit.save
|
295
|
-
#add a browse level with label nil
|
296
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:level_number=>1})
|
297
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet2",:level_number=>2})
|
298
|
-
@exhibit.expects(:browse_levels).returns([browse_level1,browse_level2]).at_least_once
|
299
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
300
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
301
|
-
|
302
|
-
#put something in params different from our facet, use facet at second level but should be ignored
|
303
|
-
helper.expects(:params).returns({:f=>{"my_facet2"=>["val3"]}}).at_least_once
|
304
|
-
facet1 = mock()
|
305
|
-
facet1.expects(:name).returns("my_facet").at_least_once
|
306
|
-
item1 = mock()
|
307
|
-
item1.expects(:value).returns("val1").at_least_once
|
308
|
-
item2 = mock()
|
309
|
-
item2.expects(:value).returns("val2").at_least_once
|
310
|
-
item3 = mock()
|
311
|
-
item3.stubs(:value).returns("val3")
|
312
|
-
facet1.expects(:items).returns([item1,item2]).at_least_once
|
313
|
-
facet2 = mock()
|
314
|
-
facet2.expects(:name).returns("my_facet2").at_least_once
|
315
|
-
#stub so it can be called but not necessarily expected
|
316
|
-
facet2.stubs(:items).returns([item3])
|
317
|
-
response = mock()
|
318
|
-
response.expects(:facets).returns([facet2,facet1]).at_least_once
|
319
|
-
helper.stubs(:browse_response).returns(response)
|
320
|
-
helper.expects(:facet_field_labels).returns("my_label")
|
321
|
-
helper.expects(:get_search_results).returns([response,mock()])
|
322
|
-
browse_data = helper.get_exhibit_navigation_data
|
323
|
-
browse_data.first.browse_levels.first.values.should == ["val1","val2"]
|
324
|
-
browse_data.first.browse_levels.first.selected.should == nil
|
325
|
-
browse_data.first.browse_levels.second.values.should == []
|
326
|
-
browse_data.first.browse_levels.second.selected.should == nil
|
327
|
-
end
|
328
|
-
|
329
|
-
it "if 3 browse levels defined and two items selected in each browse level then it should return 2 browse levels with values" do
|
330
|
-
#must have a browse set and collection not nil
|
331
|
-
@collection.save
|
332
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
333
|
-
@exhibit.save
|
334
|
-
#add a browse level with label nil
|
335
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:level_number=>1})
|
336
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet2",:level_number=>2})
|
337
|
-
browse_level3 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet3",:level_number=>3})
|
338
|
-
@exhibit.expects(:browse_levels).returns([browse_level1,browse_level2,browse_level3]).at_least_once
|
339
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
340
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
341
|
-
helper.expects(:params).returns({:collection_id=>@collection.id,:f=>{"my_facet"=>["my_val2"],"my_facet2"=>"my_val3"}}).at_least_once
|
342
|
-
helper.expects(:atrium_collection).returns(@collection)
|
343
|
-
facet = mock()
|
344
|
-
facet.expects(:name).returns("my_facet").at_least_once
|
345
|
-
item = mock()
|
346
|
-
item.expects(:value).returns("my_val").at_least_once
|
347
|
-
item2 = mock()
|
348
|
-
item2.expects(:value).returns("my_val2").at_least_once
|
349
|
-
facet.expects(:items).returns([item,item2]).at_least_once
|
350
|
-
|
351
|
-
facet2 = mock()
|
352
|
-
facet2.expects(:name).returns("my_facet2").at_least_once
|
353
|
-
item3 = mock()
|
354
|
-
item3.expects(:value).returns("my_val3").at_least_once
|
355
|
-
item4 = mock()
|
356
|
-
item4.expects(:value).returns("my_val4").at_least_once
|
357
|
-
facet2.expects(:items).returns([item3,item4]).at_least_once
|
358
|
-
|
359
|
-
facet3 = mock()
|
360
|
-
facet3.expects(:name).returns("my_facet3").at_least_once
|
361
|
-
item5 = mock()
|
362
|
-
item5.expects(:value).returns("my_val5").at_least_once
|
363
|
-
item6 = mock()
|
364
|
-
item6.expects(:value).returns("my_val6").at_least_once
|
365
|
-
facet3.expects(:items).returns([item5,item6]).at_least_once
|
366
|
-
response = mock()
|
367
|
-
response.expects(:facets).returns([facet2,facet,facet3]).at_least_once
|
368
|
-
helper.stubs(:browse_response).returns(response)
|
369
|
-
helper.expects(:facet_field_labels).returns("my_label").at_least_once
|
370
|
-
helper.expects(:get_search_results).returns([response,mock()]).at_least_once
|
371
|
-
browse_data = helper.get_exhibit_navigation_data
|
372
|
-
browse_data.first.browse_levels.first.values.should == ["my_val","my_val2"]
|
373
|
-
browse_data.first.browse_levels.first.selected.should == "my_val2"
|
374
|
-
browse_data.first.browse_levels.second.values.should == ["my_val3","my_val4"]
|
375
|
-
browse_data.first.browse_levels.second.selected.should == "my_val3"
|
376
|
-
browse_data.first.browse_levels.fetch(2).values.should == ["my_val5","my_val6"]
|
377
|
-
browse_data.first.browse_levels.fetch(2).selected.should == nil
|
378
|
-
end
|
379
|
-
|
380
|
-
it "should ignore a facet that is not present" do
|
381
|
-
#must have a browse set and collection not nil
|
382
|
-
@collection.save
|
383
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
384
|
-
@exhibit.save
|
385
|
-
#add a browse level with label nil
|
386
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:level_number=>1})
|
387
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet2",:level_number=>2})
|
388
|
-
@exhibit.expects(:browse_levels).returns([browse_level1,browse_level2]).at_least_once
|
389
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
390
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
391
|
-
|
392
|
-
helper.expects(:params).returns({:collection_id=>@collection.id,:f=>{"my_facet"=>["my_val2"],"my_facet2"=>["my_val3"]}}).at_least_once
|
393
|
-
facet = mock()
|
394
|
-
facet.expects(:name).returns("my_facet").at_least_once
|
395
|
-
item = mock()
|
396
|
-
item.expects(:value).returns("my_val").at_least_once
|
397
|
-
item2 = mock()
|
398
|
-
item2.expects(:value).returns("my_val2").at_least_once
|
399
|
-
facet.expects(:items).returns([item,item2]).at_least_once
|
400
|
-
response = mock()
|
401
|
-
response.expects(:facets).returns([facet]).at_least_once
|
402
|
-
helper.stubs(:browse_response).returns(response)
|
403
|
-
helper.expects(:facet_field_labels).returns("my_label").at_least_once
|
404
|
-
helper.expects(:get_search_results).returns([response,mock()]).at_least_once
|
405
|
-
#second level facet not present so it should only return second level with no values even though first level has something selected
|
406
|
-
browse_data = helper.get_exhibit_navigation_data
|
407
|
-
browse_data.first.browse_levels.size.should == 2
|
408
|
-
browse_data.first.browse_levels.first.values.should == ["my_val","my_val2"]
|
409
|
-
browse_data.first.browse_levels.first.selected.should == "my_val2"
|
410
|
-
browse_data.first.browse_levels.second.values.should == []
|
411
|
-
end
|
412
|
-
|
413
|
-
it "if 2 browse levels defined and two items selected it should handle having something selected at the lowest browse level" do
|
414
|
-
#must have a browse set and collection not nil
|
415
|
-
@collection.save
|
416
|
-
@exhibit = Atrium::Exhibit.new({:atrium_collection_id=>@collection.id,:set_number=>1})
|
417
|
-
@exhibit.save
|
418
|
-
#add a browse level with label nil
|
419
|
-
browse_level1 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet",:level_number=>1})
|
420
|
-
browse_level2 = Atrium::BrowseLevel.new({:atrium_exhibit_id=>@exhibit.id,:solr_facet_name=>"my_facet2",:level_number=>2})
|
421
|
-
@exhibit.expects(:browse_levels).returns([browse_level1,browse_level2]).at_least_once
|
422
|
-
@collection.expects(:exhibits).returns([@exhibit]).at_least_once
|
423
|
-
helper.stubs(:atrium_collection).returns(@collection)
|
424
|
-
|
425
|
-
helper.expects(:params).returns({:collection_id=>@collection.id,:f=>{"my_facet"=>["my_val2"],"my_facet2"=>["my_val3"]}}).at_least_once
|
426
|
-
facet = mock()
|
427
|
-
facet.expects(:name).returns("my_facet").at_least_once
|
428
|
-
item = mock()
|
429
|
-
item.expects(:value).returns("my_val").at_least_once
|
430
|
-
item2 = mock()
|
431
|
-
item2.expects(:value).returns("my_val2").at_least_once
|
432
|
-
facet.expects(:items).returns([item,item2]).at_least_once
|
433
|
-
facet2 = mock()
|
434
|
-
facet2.expects(:name).returns("my_facet2").at_least_once
|
435
|
-
item3 = mock()
|
436
|
-
item3.expects(:value).returns("my_val3").at_least_once
|
437
|
-
item4 = mock()
|
438
|
-
item4.expects(:value).returns("my_val4").at_least_once
|
439
|
-
facet2.expects(:items).returns([item3,item4]).at_least_once
|
440
|
-
response = mock()
|
441
|
-
response.expects(:facets).returns([facet2,facet]).at_least_once
|
442
|
-
helper.stubs(:browse_response).returns(response)
|
443
|
-
helper.expects(:facet_field_labels).returns("my_label").at_least_once
|
444
|
-
helper.expects(:get_search_results).returns([response,mock()]).at_least_once
|
445
|
-
browse_data = helper.get_exhibit_navigation_data
|
446
|
-
browse_data.first.browse_levels.size.should == 2
|
447
|
-
browse_data.first.browse_levels.first.values.should == ["my_val","my_val2"]
|
448
|
-
browse_data.first.browse_levels.first.selected.should == "my_val2"
|
449
|
-
browse_data.first.browse_levels.second.values.should == ["my_val3","my_val4"]
|
450
|
-
browse_data.first.browse_levels.second.selected.should == "my_val3"
|
451
|
-
end
|
452
|
-
end
|
453
|
-
|
454
|
-
describe "add_exclude_fq_to_solr" do
|
455
|
-
before(:each) do
|
456
|
-
@exclude_facets = {:test=>'exclude'}
|
457
|
-
end
|
458
|
-
self.solr_search_params_logic += [:add_exclude_fq_to_solr]
|
459
|
-
it "should have exclude solr parameters included in proper way" do
|
460
|
-
solr_params = solr_search_params(:exclude => @exclude_facets)
|
461
|
-
solr_params[:q].should be_blank
|
462
|
-
solr_params["spellcheck.q"].should be_blank
|
463
|
-
solr_params[:"facet.field"].should == blacklight_config[:default_solr_params][:"facet.field"]
|
464
|
-
|
465
|
-
@exclude_facets.each_value do |value|
|
466
|
-
solr_params[:fq].should include("-({!raw f=#{@exclude_facets.keys[0]}}#{value})")
|
467
|
-
end
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
describe "get_current_filter_query_params" do
|
472
|
-
self.solr_search_params_logic += [:add_exclude_fq_to_solr]
|
473
|
-
it "should return filters from collection in solr way" do
|
474
|
-
@collection.filter_query_params = {:q=>"testing",:f=>{"continent"=>["North America"]}}
|
475
|
-
filter_queries= get_current_filter_query_params(@collection,nil,nil)
|
476
|
-
filter_queries[:q].should == "testing"
|
477
|
-
filter_queries[:fq].should_not be_blank
|
478
|
-
end
|
479
|
-
|
480
|
-
it "should return filters from collection, exhibit and browse level in solr way" do
|
481
|
-
@collection.filter_query_params = {:q=>"testing",:f=>{"continent"=>["North America"]}}
|
482
|
-
exhibit=mock("atrium_exhibit")
|
483
|
-
exhibit.stubs(:filter_query_params).returns({:f=>{"format"=>["books"]}})
|
484
|
-
browse_level=mock("atrium_browse_level")
|
485
|
-
browse_level.stubs(:filter_query_params).returns({:f=>{"bl"=>["exhibit_level_1"]}})
|
486
|
-
ex_facet={:bl_exclude=>["disc"]}
|
487
|
-
browse_level.stubs(:exclude_query_params).returns({:exclude=>ex_facet})
|
488
|
-
filter_queries= get_current_filter_query_params(@collection,exhibit,browse_level)
|
489
|
-
ex_facet.each_value do |value|
|
490
|
-
filter_queries[:fq].should include("-({!raw f=#{ex_facet.keys[0]}}#{value})")
|
491
|
-
end
|
492
|
-
##TODO need to test other filters in the same way as above test in different scenarios
|
493
|
-
end
|
494
|
-
end
|
495
|
-
|
496
|
-
|
497
|
-
describe "prepare_extra_controller_params_for_collection_query" do
|
498
|
-
it "should add collection query params with params to extra_controller_params" do
|
499
|
-
@collection.filter_query_params = {:q=>"testing",:f=>{"continent"=>["North America"]}}
|
500
|
-
helper.expects(:get_current_filter_query_params).returns({:q=>"testing", :fq=>["{!raw f=continent}North America"]})
|
501
|
-
helper.expects(:blacklight_config).returns(@config)
|
502
|
-
extra_queries= prepare_extra_controller_params_for_collection_query(@collection,nil,nil,{:q=>"include params"},{})
|
503
|
-
extra_queries[:q].should == "testing AND include params"
|
504
|
-
extra_queries[:fq].should_not be_blank
|
505
|
-
end
|
506
|
-
|
507
|
-
end
|
508
|
-
|
509
|
-
describe "get_all_children" do
|
510
|
-
#TODO need to have solr running and process the real solr response for this test
|
511
|
-
#before do
|
512
|
-
# @mock_response = mock()
|
513
|
-
# @mock_response.stubs(:docs => [])
|
514
|
-
# @mock_document = mock()
|
515
|
-
# helper.expects(:get_solr_response_for_field_values).returns([@mock_response,@mock_document])
|
516
|
-
#end
|
517
|
-
# it "should return document matching given relationship name" do
|
518
|
-
# get_all_children([], "is_member_of")
|
519
|
-
# end
|
520
|
-
end
|
521
|
-
|
522
|
-
end
|