blacklight 4.9.0 → 5.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.travis.yml +22 -12
  4. data/Gemfile +3 -40
  5. data/LICENSE +1 -2
  6. data/README.md +1 -2
  7. data/Rakefile +0 -4
  8. data/VERSION +1 -1
  9. data/app/assets/images/blacklight/logo.png +0 -0
  10. data/app/assets/javascripts/blacklight/ajax_modal.js +190 -0
  11. data/app/assets/javascripts/blacklight/blacklight.js +7 -17
  12. data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
  13. data/app/assets/stylesheets/blacklight/{_blacklight_base.scss → _blacklight_base.css.scss} +0 -21
  14. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +4 -0
  15. data/app/assets/stylesheets/blacklight/_catalog.css.scss +192 -0
  16. data/app/assets/stylesheets/blacklight/_facets.css.scss +141 -0
  17. data/app/assets/stylesheets/blacklight/{_group.scss → _group.css.scss} +1 -1
  18. data/app/assets/stylesheets/blacklight/_header.css.scss +44 -0
  19. data/app/assets/stylesheets/blacklight/_layout.css.scss +5 -0
  20. data/app/assets/stylesheets/blacklight/{_modal.scss → _modal.css.scss} +7 -7
  21. data/app/assets/stylesheets/blacklight/_search_history.css.scss +20 -0
  22. data/app/assets/stylesheets/blacklight/{blacklight.scss → blacklight.css.scss} +0 -0
  23. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +14 -0
  24. data/app/controllers/bookmarks_controller.rb +0 -4
  25. data/app/controllers/feedback_controller.rb +0 -4
  26. data/app/helpers/blacklight/blacklight_helper_behavior.rb +45 -155
  27. data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -41
  28. data/app/helpers/blacklight/facets_helper_behavior.rb +20 -43
  29. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +2 -9
  30. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +9 -14
  31. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +6 -6
  32. data/app/views/_flash_msg.html.erb +9 -2
  33. data/app/views/_user_util_links.html.erb +29 -15
  34. data/app/views/bookmarks/_tools.html.erb +4 -7
  35. data/app/views/bookmarks/index.html.erb +3 -2
  36. data/app/views/catalog/_citation.html.erb +1 -1
  37. data/app/views/catalog/_constraints.html.erb +1 -1
  38. data/app/views/catalog/_constraints_element.html.erb +12 -8
  39. data/app/views/catalog/_did_you_mean.html.erb +2 -2
  40. data/app/views/catalog/_document_header.html.erb +3 -3
  41. data/app/views/catalog/_email_form.html.erb +10 -10
  42. data/app/views/catalog/_facet_layout.html.erb +11 -3
  43. data/app/views/catalog/_facet_limit.html.erb +7 -7
  44. data/app/views/catalog/_facet_pagination.html.erb +8 -7
  45. data/app/views/catalog/_facet_pivot.html.erb +3 -1
  46. data/app/views/catalog/_facets.html.erb +12 -9
  47. data/app/views/catalog/_paginate_compact.html.erb +1 -7
  48. data/app/views/catalog/_per_page_widget.html.erb +5 -8
  49. data/app/views/catalog/_previous_next_doc.html.erb +11 -9
  50. data/app/views/catalog/_refworks_form.html.erb +3 -4
  51. data/app/views/catalog/_results_pagination.html.erb +1 -1
  52. data/app/views/catalog/_search_form.html.erb +16 -14
  53. data/app/views/catalog/_show_sidebar.html.erb +7 -9
  54. data/app/views/catalog/_show_tools.html.erb +13 -7
  55. data/app/views/catalog/_sms_form.html.erb +8 -8
  56. data/app/views/catalog/_sort_and_per_page.html.erb +4 -6
  57. data/app/views/catalog/_sort_widget.html.erb +5 -6
  58. data/app/views/catalog/email.html.erb +1 -1
  59. data/app/views/catalog/facet.html.erb +2 -8
  60. data/app/views/catalog/index.html.erb +11 -6
  61. data/app/views/catalog/show.html.erb +5 -5
  62. data/app/views/catalog/sms.html.erb +1 -1
  63. data/app/views/catalog/sms_sent.html.erb +1 -1
  64. data/app/views/feedback/complete.html.erb +2 -2
  65. data/app/views/feedback/show.html.erb +1 -1
  66. data/app/views/kaminari/blacklight/_paginator.html.erb +1 -1
  67. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +25 -5
  68. data/app/views/layouts/blacklight.html.erb +23 -23
  69. data/app/views/saved_searches/index.html.erb +2 -2
  70. data/app/views/search_history/index.html.erb +5 -7
  71. data/app/views/shared/_header_navbar.html.erb +23 -23
  72. data/blacklight.gemspec +10 -13
  73. data/config/locales/blacklight.en.yml +1 -12
  74. data/config/locales/blacklight.fr.yml +1 -12
  75. data/gemfiles/rails3.gemfile +21 -0
  76. data/gemfiles/rails4.gemfile +20 -0
  77. data/lib/blacklight.rb +0 -8
  78. data/lib/blacklight/base.rb +0 -2
  79. data/lib/blacklight/catalog.rb +6 -32
  80. data/lib/blacklight/catalog/search_context.rb +8 -48
  81. data/lib/blacklight/configurable.rb +2 -1
  82. data/lib/blacklight/configuration.rb +1 -2
  83. data/lib/blacklight/configuration/facet_field.rb +0 -2
  84. data/lib/blacklight/engine.rb +3 -3
  85. data/lib/blacklight/legacy_controller_methods.rb +1 -64
  86. data/lib/blacklight/rails/routes.rb +17 -0
  87. data/lib/blacklight/routes.rb +46 -40
  88. data/lib/blacklight/solr.rb +1 -0
  89. data/lib/blacklight/solr/document.rb +21 -42
  90. data/lib/blacklight/solr/facet_paginator.rb +30 -54
  91. data/lib/blacklight/solr/request.rb +45 -0
  92. data/lib/blacklight/solr_helper.rb +16 -53
  93. data/lib/blacklight/solr_response.rb +0 -6
  94. data/lib/blacklight/user.rb +2 -7
  95. data/lib/blacklight/utils.rb +1 -9
  96. data/lib/generators/blacklight/assets_generator.rb +0 -14
  97. data/lib/generators/blacklight/blacklight_generator.rb +17 -14
  98. data/lib/generators/blacklight/templates/blacklight.css.scss +3 -0
  99. data/lib/generators/blacklight/templates/catalog_controller.rb +4 -1
  100. data/lib/railties/blacklight.rake +3 -1
  101. data/solr/sample_solr_documents.yml +641 -0
  102. data/spec/controllers/application_controller_spec.rb +5 -21
  103. data/spec/controllers/bookmarks_controller_spec.rb +11 -11
  104. data/spec/controllers/catalog_controller_spec.rb +122 -119
  105. data/spec/controllers/search_history_controller_spec.rb +8 -8
  106. data/spec/features/alternate_controller_spec.rb +5 -5
  107. data/spec/features/facets_spec.rb +9 -0
  108. data/spec/features/record_view_spec.rb +1 -1
  109. data/spec/features/search_filters_spec.rb +97 -41
  110. data/spec/features/search_results_spec.rb +14 -17
  111. data/spec/features/search_sort_spec.rb +1 -1
  112. data/spec/helpers/blacklight_helper_spec.rb +170 -285
  113. data/spec/helpers/catalog_helper_spec.rb +57 -96
  114. data/spec/helpers/facets_helper_spec.rb +130 -152
  115. data/spec/helpers/hash_as_hidden_fields_spec.rb +9 -15
  116. data/spec/helpers/render_constraints_helper_spec.rb +5 -5
  117. data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
  118. data/spec/lib/blacklight/routes_spec.rb +25 -0
  119. data/spec/lib/blacklight/solr/request_spec.rb +37 -0
  120. data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
  121. data/spec/lib/blacklight_configurable_spec.rb +16 -16
  122. data/spec/lib/blacklight_configuration_spec.rb +132 -132
  123. data/spec/lib/blacklight_email_spec.rb +4 -4
  124. data/spec/lib/blacklight_sms_spec.rb +4 -4
  125. data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
  126. data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
  127. data/spec/lib/blacklight_solr_document_spec.rb +36 -36
  128. data/spec/lib/blacklight_solr_response_spec.rb +43 -48
  129. data/spec/lib/blacklight_spec.rb +6 -14
  130. data/spec/lib/blacklight_user_spec.rb +5 -9
  131. data/spec/lib/facet_paginator_spec.rb +59 -51
  132. data/spec/lib/search_fields_spec.rb +13 -13
  133. data/spec/lib/solr_helper_spec.rb +258 -304
  134. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  135. data/spec/lib/utils_spec.rb +16 -46
  136. data/spec/models/bookmark_spec.rb +6 -7
  137. data/spec/models/record_mailer_spec.rb +16 -16
  138. data/spec/models/search_spec.rb +8 -8
  139. data/spec/models/solr_document_spec.rb +6 -77
  140. data/spec/routing/catalog_routing_spec.rb +16 -10
  141. data/spec/spec_helper.rb +7 -7
  142. data/spec/support/assert_difference.rb +2 -2
  143. data/spec/support/features.rb +0 -11
  144. data/spec/support/features/session_helpers.rb +3 -3
  145. data/spec/support/include_text.rb +2 -2
  146. data/spec/test_app_templates/Gemfile.extra +10 -2
  147. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -18
  148. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +13 -13
  149. data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
  150. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  151. data/spec/views/catalog/_facets.html.erb_spec.rb +13 -14
  152. data/spec/views/catalog/_index_default.erb_spec.rb +21 -21
  153. data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
  154. data/spec/views/catalog/_show_default.erb_spec.rb +21 -21
  155. data/spec/views/catalog/_show_sidebar.erb_spec.rb +7 -7
  156. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
  157. data/spec/views/catalog/index.atom.builder_spec.rb +29 -29
  158. data/spec/views/catalog/index.html.erb_spec.rb +6 -7
  159. data/tasks/blacklight.rake +8 -2
  160. metadata +84 -180
  161. data/app/assets/javascripts/blacklight/css_dropdowns.js +0 -10
  162. data/app/assets/javascripts/blacklight/facet_expand_contract.js +0 -41
  163. data/app/assets/javascripts/blacklight/lightbox_dialog.js +0 -70
  164. data/app/assets/javascripts/blacklight/select_submit.js +0 -27
  165. data/app/assets/javascripts/blacklight/zebra_stripe.js +0 -13
  166. data/app/assets/javascripts/improved-modal/bootstrap-modal.js +0 -355
  167. data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +0 -370
  168. data/app/assets/stylesheets/blacklight/_bookmark.scss +0 -33
  169. data/app/assets/stylesheets/blacklight/_catalog.scss +0 -255
  170. data/app/assets/stylesheets/blacklight/_dropdown.scss +0 -57
  171. data/app/assets/stylesheets/blacklight/_facets.scss +0 -197
  172. data/app/assets/stylesheets/blacklight/_footer.scss +0 -0
  173. data/app/assets/stylesheets/blacklight/_header.scss +0 -53
  174. data/app/assets/stylesheets/blacklight/_layout.scss +0 -10
  175. data/app/assets/stylesheets/blacklight/_mixins.scss +0 -0
  176. data/app/assets/stylesheets/blacklight/_print.scss +0 -0
  177. data/app/assets/stylesheets/blacklight/_responsive.scss +0 -3
  178. data/app/assets/stylesheets/blacklight/_search_history.scss +0 -42
  179. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +0 -49
  180. data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.scss +0 -5
  181. data/app/assets/stylesheets/blacklight/responsive_partials/_facets.scss +0 -37
  182. data/app/assets/stylesheets/blacklight/responsive_partials/_header.scss +0 -30
  183. data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +0 -217
  184. data/app/helpers/blacklight/html_head_helper_behavior.rb +0 -118
  185. data/app/helpers/html_head_helper.rb +0 -3
  186. data/app/views/catalog/_bookmark_form.html.erb +0 -7
  187. data/app/views/catalog/_marc_view.html.erb +0 -32
  188. data/app/views/catalog/librarian_view.html.erb +0 -10
  189. data/config/routes.rb +0 -17
  190. data/doc/Atom-Responses.md +0 -90
  191. data/doc/Blacklight-3.0-Release-Notes-And-Upgrade-Guide.md +0 -107
  192. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
  193. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
  194. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
  195. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
  196. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
  197. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -80
  198. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
  199. data/doc/Blacklight-4.0-release-notes-and-upgrade-guide.md +0 -135
  200. data/doc/Blacklight-4.1-release-notes-and-upgrade-guide.md +0 -17
  201. data/doc/Blacklight-4.2-release-notes-and-upgrade-guide.md +0 -25
  202. data/doc/Blacklight-4.3-release-notes-and-upgrade-guide.md +0 -21
  203. data/doc/Blacklight-4.4-release-notes-and-upgrade-guide.md +0 -41
  204. data/doc/Blacklight-Add-ons.md +0 -28
  205. data/doc/Blacklight-configuration.md +0 -411
  206. data/doc/Blacklight-on-Heroku.md +0 -135
  207. data/doc/Code4Lib-2014.md +0 -48
  208. data/doc/Community-principles.md +0 -44
  209. data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
  210. data/doc/Configuring-rails-routes.md +0 -13
  211. data/doc/Contributing-to-Blacklight.md +0 -25
  212. data/doc/Examples.md +0 -94
  213. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  214. data/doc/FAQs.md +0 -1
  215. data/doc/Home.md +0 -80
  216. data/doc/How-to-release-a-version.md +0 -29
  217. data/doc/Indexing-your-data-into-solr.md +0 -32
  218. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  219. data/doc/Internationalization.md +0 -32
  220. data/doc/JSON-API.md +0 -17
  221. data/doc/Pagination.md +0 -51
  222. data/doc/Providing-your-own-view-templates.md +0 -109
  223. data/doc/Quickstart.md +0 -115
  224. data/doc/README_SOLR.md +0 -245
  225. data/doc/Release-Notes-And-Upgrade-Guides.md +0 -20
  226. data/doc/Roadmap.md +0 -43
  227. data/doc/Sunspot-for-indexing.md +0 -46
  228. data/doc/Theming.md +0 -64
  229. data/doc/User-Authentication.md +0 -60
  230. data/doc/testing.md +0 -57
  231. data/lib/SolrMarc.jar +0 -0
  232. data/lib/blacklight/mash.rb +0 -19
  233. data/lib/blacklight/solr/document/marc.rb +0 -71
  234. data/lib/blacklight/solr/document/marc_export.rb +0 -590
  235. data/lib/generators/blacklight/marc_generator.rb +0 -66
  236. data/lib/generators/blacklight/templates/blacklight.scss +0 -4
  237. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +0 -37
  238. data/lib/generators/blacklight/templates/config/SolrMarc/config.properties +0 -37
  239. data/lib/generators/blacklight/templates/config/SolrMarc/index.properties +0 -97
  240. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh +0 -47
  241. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/format.bsh +0 -126
  242. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/README_MAPS +0 -1
  243. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/callnumber_map.properties +0 -407
  244. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/composition_era_map.properties +0 -56
  245. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/country_map.properties +0 -379
  246. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/format_map.properties +0 -50
  247. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/instrument_map.properties +0 -101
  248. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/language_map.properties +0 -490
  249. data/lib/railties/solr_marc.rake +0 -162
  250. data/spec/data/test_data.utf8.mrc +0 -1
  251. data/spec/features/librarian_view_spec.rb +0 -13
  252. data/spec/helpers/html_head_helper_spec.rb +0 -164
  253. data/spec/lib/blacklight_solr_document_marc_spec.rb +0 -89
  254. data/spec/lib/marc_export_spec.rb +0 -746
  255. data/spec/lib/tasks/solr_marc_task_spec.rb +0 -60
  256. data/spec/requests/alternate_controller_spec.rb +0 -16
  257. data/spec/routing/routes_spec.rb +0 -20
  258. data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -33
  259. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +0 -49
  260. data/test_support/data/test_data.utf8.mrc +0 -1
@@ -6,25 +6,19 @@ describe HashAsHiddenFieldsHelper do
6
6
  before(:each) do
7
7
  @hash = {:q => "query", :search_field => "search_field", :per_page=>10, :page=>5, :extra_arbitrary_key=>"arbitrary_value", :f=> {:field1 => ["a", "b"], :field2=> ["z"]}}
8
8
  end
9
- around(:each) do |example|
10
- tmp_value = Capybara.ignore_hidden_elements
11
- Capybara.ignore_hidden_elements = false
12
- example.run
13
- Capybara.ignore_hidden_elements = tmp_value
14
- end
15
9
 
16
10
  it "should convert a hash with nested complex data to Rails-style hidden form fields" do
17
11
 
18
- generated = render_hash_as_hidden_fields(@hash)
19
-
20
- expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']")
21
- expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']")
22
- expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']")
23
- expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
24
- expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
25
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
26
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
12
+ generated = hash_as_hidden_fields(@hash)
27
13
 
14
+ generated.should have_selector("input[type='hidden'][name='q'][value='query']")
15
+ generated.should have_selector("input[type='hidden'][name='per_page'][value='10']")
16
+ generated.should have_selector("input[type='hidden'][name='page'][value='5']")
17
+ generated.should have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
18
+ generated.should have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
19
+ generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
20
+ generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
21
+
28
22
  end
29
23
 
30
24
  end
@@ -4,12 +4,12 @@ describe RenderConstraintsHelper do
4
4
 
5
5
  before do
6
6
  # the helper methods below infer paths from the current route
7
- controller.request.path_parameters[:controller] = 'catalog'
7
+ controller.request.path_parameters["controller"] = 'catalog'
8
8
  end
9
9
 
10
10
  describe '#render_constraints_query' do
11
11
  it "should have a link relative to the current url" do
12
- expect(helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'})).to have_selector "a[href='/?f%5Btype%5D=journal']"
12
+ helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/?f%5Btype%5D=journal']"
13
13
  end
14
14
  end
15
15
 
@@ -18,12 +18,12 @@ describe RenderConstraintsHelper do
18
18
  @config = Blacklight::Configuration.new do |config|
19
19
  config.add_facet_field 'type'
20
20
  end
21
- allow(helper).to receive_messages(:blacklight_config => @config)
21
+ helper.stub(:blacklight_config => @config)
22
22
  end
23
23
  it "should have a link relative to the current url" do
24
24
  result = helper.render_filter_element('type', ['journal'], {:q=>'biz'})
25
- expect(result.size).to eq(1)
26
- expect(result.first).to have_link "Remove constraint Type: journal", href: "/?q=biz"
25
+ # I'm not certain how the ampersand gets in there. It's not important.
26
+ result.should have_selector "a[href='/?&q=biz']"
27
27
  end
28
28
  end
29
29
 
@@ -13,41 +13,41 @@ describe SearchHistoryConstraintsHelper do
13
13
  end
14
14
 
15
15
  before(:each) do
16
- allow(helper).to receive(:blacklight_config).and_return(@config)
16
+ helper.stub(:blacklight_config).and_return(@config)
17
17
  end
18
18
 
19
19
  describe "render_search_to_s_*" do
20
20
  describe "render_search_to_s_element" do
21
21
  it "should render basic element" do
22
22
  response = helper.render_search_to_s_element("key", "value")
23
- expect(response).to have_selector("span.constraint") do |span|
24
- expect(span).to have_selector("span.filterName", :content => "key:")
25
- expect(span).to have_selector("span.filterValue", :content => "value")
23
+ response.should have_selector("span.constraint") do |span|
24
+ span.should have_selector("span.filterName", :content => "key:")
25
+ span.should have_selector("span.filterValue", :content => "value")
26
26
  end
27
- expect(response.html_safe?).to eq(true)
27
+ response.html_safe?.should == true
28
28
  end
29
29
  it "should escape them that need escaping" do
30
30
  response = helper.render_search_to_s_element("key>", "value>")
31
- expect(response).to have_selector("span.constraint") do |span|
32
- expect(span).to have_selector("span.filterName") do |s2|
31
+ response.should have_selector("span.constraint") do |span|
32
+ span.should have_selector("span.filterName") do |s2|
33
33
  # Note: nokogiri's gettext will unescape the inner html
34
34
  # which seems to be what rspecs "contains" method calls on
35
35
  # text nodes - thus the to_s inserted below.
36
- expect(s2.to_s).to match(/key>:/)
36
+ s2.to_s.should match(/key>:/)
37
37
  end
38
- expect(span).to have_selector("span.filterValue") do |s3|
39
- expect(s3.to_s).to match(/value>/)
38
+ span.should have_selector("span.filterValue") do |s3|
39
+ s3.to_s.should match(/value>/)
40
40
  end
41
41
  end
42
- expect(response.html_safe?).to eq(true)
42
+ response.html_safe?.should == true
43
43
  end
44
44
  it "should not escape with options set thus" do
45
45
  response = helper.render_search_to_s_element("key>", "value>", :escape_key => false, :escape_value => false)
46
- expect(response).to have_selector("span.constraint") do |span|
47
- expect(span).to have_selector("span.filterName", :content => "key>:")
48
- expect(span).to have_selector("span.filterValue", :content => "value>")
46
+ response.should have_selector("span.constraint") do |span|
47
+ span.should have_selector("span.filterName", :content => "key>:")
48
+ span.should have_selector("span.filterValue", :content => "value>")
49
49
  end
50
- expect(response.html_safe?).to eq(true)
50
+ response.html_safe?.should == true
51
51
  end
52
52
  end
53
53
 
@@ -56,15 +56,15 @@ describe SearchHistoryConstraintsHelper do
56
56
  @params = {:q => "history", :f => {"some_facet" => ["value1", "value1"], "other_facet" => ["other1"]}}
57
57
  end
58
58
  it "should call lesser methods" do
59
- allow(helper).to receive(:blacklight_config).and_return(@config)
60
- allow(helper).to receive(:default_search_field).and_return(Blacklight::Configuration::SearchField.new(:key => 'default_search_field', :display_label => 'Default'))
61
- allow(helper).to receive(:label_for_search_field).with(nil).and_return('')
59
+ helper.stub(:blacklight_config).and_return(@config)
60
+ helper.stub(:default_search_field).and_return(Blacklight::Configuration::SearchField.new(:key => 'default_search_field', :display_label => 'Default'))
61
+ helper.stub(:label_for_search_field).with(nil).and_return('')
62
62
  # API hooks expect this to be so
63
63
  response = helper.render_search_to_s(@params)
64
64
 
65
- expect(response).to include( helper.render_search_to_s_q(@params))
66
- expect(response).to include( helper.render_search_to_s_filters(@params))
67
- expect(response.html_safe?).to eq(true)
65
+ response.should include( helper.render_search_to_s_q(@params))
66
+ response.should include( helper.render_search_to_s_filters(@params))
67
+ response.html_safe?.should == true
68
68
  end
69
69
  end
70
70
 
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ describe Blacklight::Routes do
3
+ subject { Blacklight::Routes.new(router, options) }
4
+ let(:router) { double }
5
+
6
+ describe "solr_document" do
7
+ describe "without constraints" do
8
+ let(:options) { Hash.new }
9
+ it "should define the resources" do
10
+ router.should_receive(:resources).with(:solr_document, {:path=>:records, :controller=>:records, :only=>[:show, :update]})
11
+ router.should_receive(:resources).with(:records, :only=>[:show, :update])
12
+ subject.solr_document(:records)
13
+ end
14
+ end
15
+
16
+ describe "with constraints" do
17
+ let(:options) { { :constraints => {id: /[a-z]+/, format: false } } }
18
+ it "should define the resources" do
19
+ router.should_receive(:resources).with(:solr_document, {:path=>:records, :controller=>:records, :only=>[:show, :update], :constraints=>{:id=>/[a-z]+/, :format=>false} })
20
+ router.should_receive(:resources).with(:records, :only=>[:show, :update], :constraints=>{:id=>/[a-z]+/, :format=>false})
21
+ subject.solr_document(:records)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Blacklight::Solr::Request do
4
+ before do
5
+ subject[:qt] = 'hey'
6
+ subject[:fq] = ["what's up.", "dood"]
7
+ subject['q'] = "what's"
8
+ subject[:wt] = "going"
9
+ subject[:start] = "on"
10
+ subject[:rows] = "Man"
11
+ subject['hl'] = "I"
12
+ subject['hl.fl'] = "wish"
13
+ subject['group'] = "I"
14
+ subject['defType'] = "had"
15
+ subject['spellcheck'] = "a"
16
+ subject['spellcheck.q'] = "fleece"
17
+ subject['f.title_facet.facet.limit'] = "vest"
18
+ subject['facet.field'] = []
19
+ end
20
+ it "should accept valid parameters" do
21
+ expect(subject.to_hash).to eq({"defType" => "had",
22
+ "f.title_facet.facet.limit" => "vest",
23
+ "fq" => ["what's up.", "dood"],
24
+ "group" => "I",
25
+ "hl" => "I",
26
+ "hl.fl" => "wish",
27
+ "q" => "what's",
28
+ "qt" => "hey",
29
+ "rows" => "Man",
30
+ "spellcheck" => "a",
31
+ "spellcheck.q" => "fleece",
32
+ "start" => "on",
33
+ "wt" => "going"
34
+ })
35
+ end
36
+
37
+ end
@@ -12,9 +12,9 @@ describe Blacklight::SolrResponse::GroupResponse do
12
12
 
13
13
  describe "groups" do
14
14
  it "should return an array of Groups" do
15
- expect(response.grouped).to be_a Array
15
+ response.grouped.should be_a Array
16
16
 
17
- expect(group.groups.size).to eq(2)
17
+ expect(group.groups).to have(2).items
18
18
  group.groups.each do |group|
19
19
  expect(group).to be_a Blacklight::SolrResponse::Group
20
20
  end
@@ -20,17 +20,17 @@ describe "Blacklight::Configurable" do
20
20
  end
21
21
  end
22
22
  it "should inherit the configuration when subclassed" do
23
- expect(TestCaseInheritence::Child.blacklight_config.list).to include(1,2,3)
23
+ TestCaseInheritence::Child.blacklight_config.list.should include(1,2,3)
24
24
  end
25
25
 
26
26
  it "inherited version should be a deep copy, not original" do
27
- expect(TestCaseInheritence::Child.blacklight_config).not_to be(TestCaseInheritence::Parent.blacklight_config)
27
+ TestCaseInheritence::Child.blacklight_config.should_not be(TestCaseInheritence::Parent.blacklight_config)
28
28
 
29
29
  TestCaseInheritence::Child.blacklight_config.list << "child_only"
30
30
 
31
31
 
32
- expect(TestCaseInheritence::Child.blacklight_config.list).to include("child_only")
33
- expect(TestCaseInheritence::Parent.blacklight_config.list).not_to include("child_only")
32
+ TestCaseInheritence::Child.blacklight_config.list.should include("child_only")
33
+ TestCaseInheritence::Parent.blacklight_config.list.should_not include("child_only")
34
34
  end
35
35
  end
36
36
 
@@ -47,7 +47,7 @@ describe "Blacklight::Configurable" do
47
47
  a = Class.new
48
48
  a.send(:include, Blacklight::Configurable)
49
49
 
50
- expect(a.blacklight_config.default_solr_params).to be_empty
50
+ a.blacklight_config.default_solr_params.should be_empty
51
51
  end
52
52
 
53
53
  it "should allow the user to provide a default configuration" do
@@ -56,7 +56,7 @@ describe "Blacklight::Configurable" do
56
56
  Blacklight::Configurable.default_configuration = Blacklight::Configuration.new :a => 1
57
57
 
58
58
  a.send(:include, Blacklight::Configurable)
59
- expect(a.blacklight_config.a).to eq(1)
59
+ a.blacklight_config.a.should == 1
60
60
  end
61
61
 
62
62
  it "has configure_blacklight convenience method" do
@@ -67,7 +67,7 @@ describe "Blacklight::Configurable" do
67
67
  config.my_key = 'value'
68
68
  end
69
69
 
70
- expect(klass.blacklight_config.my_key).to eq('value')
70
+ klass.blacklight_config.my_key.should == 'value'
71
71
  end
72
72
 
73
73
  it "allows the instance to set a radically different config from the class" do
@@ -78,8 +78,8 @@ describe "Blacklight::Configurable" do
78
78
  instance = klass.new
79
79
  instance.blacklight_config = Blacklight::Configuration.new
80
80
 
81
- expect(instance.blacklight_config).not_to eq(klass.blacklight_config)
82
- expect(instance.blacklight_config.foo).to be_nil
81
+ instance.blacklight_config.should_not == klass.blacklight_config
82
+ instance.blacklight_config.foo.should be_nil
83
83
  end
84
84
 
85
85
  it "allows instance to set it's own config seperate from class" do
@@ -94,11 +94,11 @@ describe "Blacklight::Configurable" do
94
94
 
95
95
  instance = klass.new
96
96
  instance.blacklight_config.bar << "123"
97
- expect(instance.blacklight_config).not_to eq(klass.blacklight_config)
98
- expect(klass.blacklight_config.foo).to eq("bar")
99
- expect(instance.blacklight_config.foo).to eq("bar")
100
- expect(klass.blacklight_config.bar).not_to include("123")
101
- expect(instance.blacklight_config.bar).to include("asd", "123")
97
+ instance.blacklight_config.should_not == klass.blacklight_config
98
+ klass.blacklight_config.foo.should == "bar"
99
+ instance.blacklight_config.foo.should == "bar"
100
+ klass.blacklight_config.bar.should_not include("123")
101
+ instance.blacklight_config.bar.should include("asd", "123")
102
102
  end
103
103
 
104
104
  it "configurable classes should not mutate the default configuration object" do
@@ -110,8 +110,8 @@ describe "Blacklight::Configurable" do
110
110
  klass2.send(:include, Blacklight::Configurable)
111
111
  klass2.blacklight_config.foo = "asdf"
112
112
 
113
- expect(klass.blacklight_config.foo).to eq("bar")
114
- expect(klass2.blacklight_config.foo).to eq("asdf")
113
+ klass.blacklight_config.foo.should == "bar"
114
+ klass2.blacklight_config.foo.should == "asdf"
115
115
  end
116
116
 
117
117
  end
@@ -3,7 +3,7 @@
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
4
4
 
5
5
  describe "Blacklight::Configuration" do
6
-
6
+
7
7
  before(:each) do
8
8
  @config = Blacklight::Configuration.new
9
9
  end
@@ -11,60 +11,60 @@ describe "Blacklight::Configuration" do
11
11
  it "should support arbitrary configuration values" do
12
12
  @config.a = 1
13
13
 
14
- expect(@config.a).to eq(1)
15
- expect(@config[:a]).to eq(1)
14
+ @config.a.should == 1
15
+ @config[:a].should == 1
16
16
  end
17
17
 
18
18
  describe "initialization" do
19
19
  it "should be an OpenStructWithHashAccess" do
20
- expect(@config).to be_a_kind_of Blacklight::OpenStructWithHashAccess
20
+ @config.should be_a_kind_of Blacklight::OpenStructWithHashAccess
21
21
  end
22
22
 
23
23
  it "should accept a block for configuration" do
24
24
  config = Blacklight::Configuration.new(:a => 1) { |c| c.a = 2 }
25
25
 
26
- expect(config.a).to eq(2)
26
+ config.a.should == 2
27
27
 
28
28
  config.configure { |c| c.a = 3 }
29
29
 
30
- expect(config.a).to eq(3)
30
+ config.a.should == 3
31
31
  end
32
32
  end
33
33
 
34
34
  describe "defaults" do
35
35
  it "should have a hash of default rsolr query parameters" do
36
- expect(@config.default_solr_params).to be_a_kind_of Hash
36
+ @config.default_solr_params.should be_a_kind_of Hash
37
37
  end
38
38
 
39
39
  it "should have openstruct values for show and index parameters" do
40
- expect(@config.show).to be_a_kind_of OpenStruct
41
- expect(@config.index).to be_a_kind_of OpenStruct
40
+ @config.show.should be_a_kind_of OpenStruct
41
+ @config.index.should be_a_kind_of OpenStruct
42
42
  end
43
43
 
44
44
  it "should introspect SolrDocument for sensible defaults for show + index" do
45
- expect(@config.show.html_title).to eq('id')
46
- expect(@config.show.heading).to eq('id')
47
- expect(@config.index.show_link).to eq('id')
45
+ @config.show.html_title.should == 'id'
46
+ @config.show.heading.should == 'id'
47
+ @config.index.show_link.should == 'id'
48
48
  end
49
49
 
50
50
  it "should have ordered hashes for field configuration" do
51
- expect(@config.facet_fields).to be_a_kind_of ActiveSupport::OrderedHash
52
- expect(@config.index_fields).to be_a_kind_of ActiveSupport::OrderedHash
53
- expect(@config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
54
- expect(@config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
55
- expect(@config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
56
- expect(@config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
57
- expect(@config.sort_fields).to be_a_kind_of ActiveSupport::OrderedHash
51
+ @config.facet_fields.should be_a_kind_of ActiveSupport::OrderedHash
52
+ @config.index_fields.should be_a_kind_of ActiveSupport::OrderedHash
53
+ @config.show_fields.should be_a_kind_of ActiveSupport::OrderedHash
54
+ @config.search_fields.should be_a_kind_of ActiveSupport::OrderedHash
55
+ @config.show_fields.should be_a_kind_of ActiveSupport::OrderedHash
56
+ @config.search_fields.should be_a_kind_of ActiveSupport::OrderedHash
57
+ @config.sort_fields.should be_a_kind_of ActiveSupport::OrderedHash
58
58
  end
59
59
  end
60
60
 
61
61
  describe "spell_max" do
62
62
  it "should default to 5" do
63
- expect(Blacklight::Configuration.new.spell_max).to eq(5)
63
+ Blacklight::Configuration.new.spell_max.should == 5
64
64
  end
65
-
65
+
66
66
  it "should accept config'd value" do
67
- expect(Blacklight::Configuration.new(:spell_max => 10).spell_max).to eq(10)
67
+ Blacklight::Configuration.new(:spell_max => 10).spell_max.should == 10
68
68
  end
69
69
  end
70
70
 
@@ -76,8 +76,8 @@ describe "Blacklight::Configuration" do
76
76
  @mock_facet = Blacklight::Configuration::FacetField.new
77
77
  config_copy.add_facet_field "dummy_field", @mock_facet
78
78
 
79
- expect(@config.a).to be_nil
80
- expect(@config.facet_fields).not_to include(@mock_facet)
79
+ @config.a.should be_nil
80
+ @config.facet_fields.should_not include(@mock_facet)
81
81
  end
82
82
  end
83
83
 
@@ -89,9 +89,9 @@ describe "Blacklight::Configuration" do
89
89
  config.add_my_custom_field 'qwerty', :label => "asdf"
90
90
  end
91
91
 
92
+
92
93
 
93
-
94
- expect(config.my_custom_fields.keys).to include('qwerty')
94
+ config.my_custom_fields.keys.should include('qwerty')
95
95
  end
96
96
 
97
97
  it "should let you define a field accessor that uses an existing field-type" do
@@ -102,37 +102,37 @@ describe "Blacklight::Configuration" do
102
102
  config.add_my_custom_facet_field 'qwerty', :label => "asdf"
103
103
  end
104
104
 
105
+
105
106
 
106
-
107
- expect(config.my_custom_facet_fields['qwerty']).to be_a_kind_of(Blacklight::Configuration::FacetField)
107
+ config.my_custom_facet_fields['qwerty'].should be_a_kind_of(Blacklight::Configuration::FacetField)
108
108
  end
109
109
 
110
110
  end
111
-
111
+
112
112
  describe "add_facet_field" do
113
113
  it "should accept field name and hash form arg" do
114
114
  @config.add_facet_field('format', :label => "Format", :limit => true)
115
-
116
- expect(@config.facet_fields["format"]).not_to be_nil
117
- expect(@config.facet_fields["format"]["label"]).to eq("Format")
118
- expect(@config.facet_fields["format"]["limit"]).to eq(true)
115
+
116
+ @config.facet_fields["format"].should_not be_nil
117
+ @config.facet_fields["format"]["label"].should == "Format"
118
+ @config.facet_fields["format"]["limit"].should == true
119
119
  end
120
120
 
121
121
  it "should accept FacetField obj arg" do
122
122
  @config.add_facet_field("format", Blacklight::Configuration::FacetField.new( :label => "Format"))
123
-
124
- expect(@config.facet_fields["format"]).not_to be_nil
125
- expect(@config.facet_fields["format"]["label"]).to eq("Format")
123
+
124
+ @config.facet_fields["format"].should_not be_nil
125
+ @config.facet_fields["format"]["label"].should == "Format"
126
126
  end
127
-
127
+
128
128
  it "should accept field name and block form" do
129
- @config.add_facet_field("format") do |facet|
129
+ @config.add_facet_field("format") do |facet|
130
130
  facet.label = "Format"
131
131
  facet.limit = true
132
132
  end
133
-
134
- expect(@config.facet_fields["format"]).not_to be_nil
135
- expect(@config.facet_fields["format"].limit).to eq(true)
133
+
134
+ @config.facet_fields["format"].should_not be_nil
135
+ @config.facet_fields["format"].limit.should == true
136
136
  end
137
137
 
138
138
  it "should accept block form" do
@@ -141,208 +141,208 @@ describe "Blacklight::Configuration" do
141
141
  facet.label = "Format"
142
142
  end
143
143
 
144
- expect(@config.facet_fields['format']).not_to be_nil
144
+ @config.facet_fields['format'].should_not be_nil
145
145
  end
146
146
 
147
147
  it "should accept a configuration hash" do
148
148
  @config.add_facet_field :field => 'format', :label => 'Format'
149
- expect(@config.facet_fields['format']).not_to be_nil
149
+ @config.facet_fields['format'].should_not be_nil
150
150
  end
151
151
 
152
152
  it "should accept array form" do
153
153
  @config.add_facet_field([{ :field => 'format', :label => 'Format'}, { :field => 'publication_date', :label => 'Publication Date' }])
154
154
 
155
- expect(@config.facet_fields.length).to eq(2)
155
+ @config.facet_fields.length.should == 2
156
156
  end
157
157
 
158
158
  it "should create default label from titleized solr field" do
159
159
  @config.add_facet_field("publication_date")
160
-
161
- expect(@config.facet_fields["publication_date"].label).to eq("Publication Date")
160
+
161
+ @config.facet_fields["publication_date"].label.should == "Publication Date"
162
162
  end
163
163
 
164
164
  it "should allow you to not show the facet in the facet bar" do
165
165
  @config.add_facet_field("publication_date", :show=>false)
166
-
167
- expect(@config.facet_fields["publication_date"]['show']).to eq false
166
+
167
+ @config.facet_fields["publication_date"]['show'].should be_false
168
168
  end
169
-
169
+
170
170
  it "should raise on nil solr field name" do
171
- expect { @config.add_facet_field(nil) }.to raise_error ArgumentError
171
+ lambda { @config.add_facet_field(nil) }.should raise_error ArgumentError
172
172
  end
173
-
173
+
174
174
  end
175
-
175
+
176
176
  describe "add_index_field" do
177
177
  it "takes hash form" do
178
178
  @config.add_index_field("title_display", :label => "Title")
179
-
180
- expect(@config.index_fields["title_display"]).not_to be_nil
181
- expect(@config.index_fields["title_display"].label).to eq("Title")
179
+
180
+ @config.index_fields["title_display"].should_not be_nil
181
+ @config.index_fields["title_display"].label.should == "Title"
182
182
  end
183
183
  it "takes IndexField param" do
184
184
  @config.add_index_field("title_display", Blacklight::Configuration::IndexField.new(:field => "title_display", :label => "Title"))
185
-
186
- expect(@config.index_fields["title_display"]).not_to be_nil
187
- expect(@config.index_fields["title_display"].label).to eq("Title")
185
+
186
+ @config.index_fields["title_display"].should_not be_nil
187
+ @config.index_fields["title_display"].label.should == "Title"
188
188
  end
189
189
  it "takes block form" do
190
- @config.add_index_field("title_display") do |field|
190
+ @config.add_index_field("title_display") do |field|
191
191
  field.label = "Title"
192
192
  end
193
- expect(@config.index_fields["title_display"]).not_to be_nil
194
- expect(@config.index_fields["title_display"].label).to eq("Title")
193
+ @config.index_fields["title_display"].should_not be_nil
194
+ @config.index_fields["title_display"].label.should == "Title"
195
195
  end
196
-
196
+
197
197
  it "creates default label from titleized field" do
198
198
  @config.add_index_field("title_display")
199
-
200
- expect(@config.index_fields["title_display"].label).to eq("Title Display")
199
+
200
+ @config.index_fields["title_display"].label.should == "Title Display"
201
201
  end
202
-
202
+
203
203
  it "should raise on nil solr field name" do
204
- expect { @config.add_index_field(nil) }.to raise_error ArgumentError
204
+ lambda { @config.add_index_field(nil) }.should raise_error ArgumentError
205
205
  end
206
206
 
207
207
  end
208
-
208
+
209
209
  describe "add_show_field" do
210
210
  it "takes hash form" do
211
211
  @config.add_show_field("title_display", :label => "Title")
212
-
213
- expect(@config.show_fields["title_display"]).not_to be_nil
214
- expect(@config.show_fields["title_display"].label).to eq("Title")
212
+
213
+ @config.show_fields["title_display"].should_not be_nil
214
+ @config.show_fields["title_display"].label.should == "Title"
215
215
  end
216
216
  it "takes ShowField argument" do
217
217
  @config.add_show_field("title_display", Blacklight::Configuration::ShowField.new(:field => "title_display", :label => "Title"))
218
-
219
- expect(@config.show_fields["title_display"]).not_to be_nil
220
- expect(@config.show_fields["title_display"].label).to eq("Title")
218
+
219
+ @config.show_fields["title_display"].should_not be_nil
220
+ @config.show_fields["title_display"].label.should == "Title"
221
221
  end
222
222
  it "takes block form" do
223
- @config.add_show_field("title_display") do |f|
223
+ @config.add_show_field("title_display") do |f|
224
224
  f.label = "Title"
225
225
  end
226
-
227
- expect(@config.show_fields["title_display"]).not_to be_nil
228
- expect(@config.show_fields["title_display"].label).to eq("Title")
226
+
227
+ @config.show_fields["title_display"].should_not be_nil
228
+ @config.show_fields["title_display"].label.should == "Title"
229
229
  end
230
-
230
+
231
231
  it "creates default label humanized from field" do
232
232
  @config.add_show_field("my_custom_field")
233
-
234
- expect(@config.show_fields["my_custom_field"].label).to eq("My Custom Field")
233
+
234
+ @config.show_fields["my_custom_field"].label.should == "My Custom Field"
235
235
  end
236
-
236
+
237
237
  it "should raise on nil solr field name" do
238
- expect { @config.add_show_field(nil) }.to raise_error ArgumentError
238
+ lambda { @config.add_show_field(nil) }.should raise_error ArgumentError
239
239
  end
240
-
240
+
241
241
  end
242
-
243
-
242
+
243
+
244
244
  describe "add_search_field" do
245
245
  it "should accept hash form" do
246
246
  c = Blacklight::Configuration.new
247
247
  c.add_search_field(:key => "my_search_key")
248
- expect(c.search_fields["my_search_key"]).not_to be_nil
248
+ c.search_fields["my_search_key"].should_not be_nil
249
249
  end
250
250
 
251
251
  it "should accept two-arg hash form" do
252
252
  c = Blacklight::Configuration.new
253
-
253
+
254
254
  c.add_search_field("my_search_type",
255
255
  :key => "my_search_type",
256
- :solr_parameters => { :qf => "my_field_qf^10" },
256
+ :solr_parameters => { :qf => "my_field_qf^10" },
257
257
  :solr_local_parameters => { :pf=>"$my_field_pf"})
258
-
258
+
259
259
  field = c.search_fields["my_search_type"]
260
-
261
- expect(field).not_to be_nil
262
-
263
-
264
- expect(field.solr_parameters).not_to be_nil
265
- expect(field.solr_local_parameters).not_to be_nil
266
-
267
-
268
- end
269
-
260
+
261
+ field.should_not be_nil
262
+
263
+
264
+ field.solr_parameters.should_not be_nil
265
+ field.solr_local_parameters.should_not be_nil
266
+
267
+
268
+ end
269
+
270
270
  it "should accept block form" do
271
271
  c = Blacklight::Configuration.new
272
-
273
- c.add_search_field("some_field") do |field|
272
+
273
+ c.add_search_field("some_field") do |field|
274
274
  field.solr_parameters = {:qf => "solr_field^10"}
275
275
  field.solr_local_parameters = {:pf => "$some_field_pf"}
276
276
  end
277
-
277
+
278
278
  f = c.search_fields["some_field"]
279
-
280
- expect(f).not_to be_nil
281
- expect(f.solr_parameters).not_to be_nil
282
- expect(f.solr_local_parameters).not_to be_nil
279
+
280
+ f.should_not be_nil
281
+ f.solr_parameters.should_not be_nil
282
+ f.solr_local_parameters.should_not be_nil
283
283
  end
284
-
284
+
285
285
  it "should accept SearchField object" do
286
286
  c = Blacklight::Configuration.new
287
-
287
+
288
288
  f = Blacklight::Configuration::SearchField.new( :foo => "bar")
289
-
289
+
290
290
  c.add_search_field("foo", f)
291
-
292
- expect(c.search_fields["foo"]).not_to be_nil
291
+
292
+ c.search_fields["foo"].should_not be_nil
293
293
  end
294
-
294
+
295
295
  it "should raise on nil key" do
296
- expect {@config.add_search_field(nil, :foo => "bar")}.to raise_error ArgumentError
296
+ lambda {@config.add_search_field(nil, :foo => "bar")}.should raise_error ArgumentError
297
297
  end
298
-
298
+
299
299
  it "creates default label from titleized field key" do
300
300
  @config.add_search_field("author_name")
301
-
302
- expect(@config.search_fields["author_name"].label).to eq("Author Name")
301
+
302
+ @config.search_fields["author_name"].label.should == "Author Name"
303
303
  end
304
-
305
-
304
+
305
+
306
306
  end
307
-
307
+
308
308
  describe "add_sort_field" do
309
309
  it "should take a hash" do
310
310
  c = Blacklight::Configuration.new
311
311
  c.add_sort_field(:key => "my_sort_key", :sort => "score desc")
312
- expect(c.sort_fields["my_sort_key"]).not_to be_nil
312
+ c.sort_fields["my_sort_key"].should_not be_nil
313
313
  end
314
314
 
315
315
  it "should take a two-arg form with a hash" do
316
- @config.add_sort_field("score desc, pub_date_sort desc, title_sort asc", :label => "relevance")
317
-
316
+ @config.add_sort_field("score desc, pub_date_sort desc, title_sort asc", :label => "relevance")
318
317
 
319
- expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).not_to be_nil
318
+
319
+ @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
320
320
  end
321
-
321
+
322
322
  it "should take a SortField object" do
323
323
  @config.add_sort_field(Blacklight::Configuration::SortField.new(:label => "relevance", :sort => "score desc, pub_date_sort desc, title_sort asc"
324
- ))
325
- expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).not_to be_nil
324
+ ))
325
+ @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
326
326
  end
327
-
327
+
328
328
  it "should take block form" do
329
329
  @config.add_sort_field do |field|
330
330
  field.label = "relevance"
331
331
  field.sort = "score desc, pub_date_sort desc, title_sort asc"
332
332
  end
333
-
334
- expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).not_to be_nil
333
+
334
+ @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
335
335
 
336
336
  end
337
337
  end
338
-
338
+
339
339
  describe "#default_search_field" do
340
340
  it "should use the field with a :default key" do
341
341
  @config.add_search_field('search_field_1')
342
342
  @config.add_search_field('search_field_2', :default => true)
343
343
 
344
- expect(@config.default_search_field.key).to eq('search_field_2')
344
+ @config.default_search_field.key.should == 'search_field_2'
345
345
  end
346
346
  end
347
-
347
+
348
348
  end