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
@@ -5,13 +5,13 @@ def assert_difference(executable, how_many = 1, &block)
5
5
  before = eval(executable)
6
6
  yield
7
7
  after = eval(executable)
8
- expect(after).to eq(before + how_many)
8
+ after.should == before + how_many
9
9
  end
10
10
 
11
11
  def assert_no_difference(executable, &block)
12
12
  before = eval(executable)
13
13
  yield
14
14
  after = eval(executable)
15
- expect(after).to eq(before)
15
+ after.should == before
16
16
  end
17
17
 
@@ -4,15 +4,4 @@ require File.expand_path("../features/session_helpers.rb", __FILE__)
4
4
 
5
5
  RSpec.configure do |config|
6
6
  config.include Features::SessionHelpers, type: :feature
7
-
8
- # rspec-rails 3 will no longer automatically infer an example group's spec type
9
- # from the file location. You can explicitly opt-in to the feature using this
10
- # config option.
11
- # To explicitly tag specs without using automatic inference, set the `:type`
12
- # metadata manually:
13
- #
14
- # describe ThingsController, :type => :controller do
15
- # # Equivalent to being in spec/controllers
16
- # end
17
- config.infer_spec_type_from_file_location!
18
7
  end
@@ -14,9 +14,9 @@ module Features
14
14
  email = "#{login}@#{login}.com"
15
15
  user = User.create(:email => email, :password => "password", :password_confirmation => "password")
16
16
  visit new_user_session_path
17
- fill_in("user_email", :with => email)
18
- fill_in("user_password", :with => "password")
19
- click_button("Log in")
17
+ fill_in("user_email", :with => email)
18
+ fill_in("user_password", :with => "password")
19
+ click_button("Sign in")
20
20
  end
21
21
  end
22
22
  end
@@ -8,11 +8,11 @@ module RSpec::Rails
8
8
  @content.include?(text)
9
9
  end
10
10
 
11
- failure_message do |text|
11
+ failure_message_for_should do |text|
12
12
  "expected '#{@content}' to contain '#{text}'"
13
13
  end
14
14
 
15
- failure_message_when_negated do |text|
15
+ failure_message_for_should_not do |text|
16
16
  "expected #{@content} to not contain '#{text}'"
17
17
  end
18
18
  end
@@ -1,3 +1,9 @@
1
+ platforms :jruby do
2
+ gem 'jdbc-sqlite3'
3
+ gem 'mediashelf-loggable', '>= 0.4.8'
4
+ gem 'therubyrhino'
5
+ end
6
+
1
7
  platforms :ruby do
2
8
  gem 'sqlite3'
3
9
  end
@@ -5,10 +11,12 @@ end
5
11
  gem 'jquery-rails'
6
12
 
7
13
  group :test do
14
+ gem 'rspec-rails', '~> 2.13'
8
15
  gem 'generator_spec'
9
16
  gem 'poltergeist'
10
- gem 'capybara'
17
+ gem 'simplecov', :platform => :mri_19
18
+ gem 'simplecov-rcov', :platform => :mri_19
11
19
  end
12
20
 
13
21
  gem 'jettywrapper', '>= 1.2.0'
14
- gem 'test-unit'
22
+
@@ -1,11 +1,11 @@
1
1
  require 'rails/generators'
2
2
 
3
3
  class TestAppGenerator < Rails::Generators::Base
4
- source_root "../spec/test_app_templates"
4
+ source_root File.expand_path("../../../../test_app_templates", __FILE__)
5
5
 
6
- def fix_travis_rails_4
6
+ def fix_travis_rails_4
7
7
  if ENV['TRAVIS']
8
- insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
8
+ insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
9
9
  "@charset \"UTF-8\";\n"
10
10
  end
11
11
  end
@@ -15,31 +15,25 @@ class TestAppGenerator < Rails::Generators::Base
15
15
  copy_file "lib/tasks/blacklight_test_app.rake"
16
16
  end
17
17
 
18
- def remove_index
18
+ def remove_index
19
19
  remove_file "public/index.html"
20
20
  remove_file 'app/assets/images/rails.png'
21
21
  end
22
22
 
23
23
  def run_blacklight_generator
24
- say_status("warning", "GENERATING BL", :yellow)
24
+ say_status("warning", "GENERATING BL", :yellow)
25
+ gem 'blacklight_marc', :github => 'projectblacklight/blacklight_marc'
25
26
 
26
- generate 'blacklight', '--devise'
27
+ Bundler.with_clean_env do
28
+ run "bundle install"
29
+ end
30
+
31
+ generate 'blacklight', '--devise --marc'
27
32
  end
28
33
 
29
34
  def run_test_support_generator
30
- say_status("warning", "GENERATING test_support", :yellow)
35
+ say_status("warning", "GENERATING test_support", :yellow)
31
36
 
32
37
  generate 'blacklight:test_support'
33
38
  end
34
-
35
- # Add favicon.ico to asset path
36
- # ADD THIS LINE Rails.application.config.assets.precompile += %w( favicon.ico )
37
- # TO config/assets.rb
38
- def add_favicon_to_asset_path
39
- say_status("warning", "ADDING FAVICON TO ASSET PATH", :yellow)
40
-
41
- append_to_file 'config/initializers/assets.rb' do
42
- 'Rails.application.config.assets.precompile += %w( favicon.ico )'
43
- end
44
- end
45
39
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'spec_helper'
3
3
 
4
4
  describe "catalog/_constraints_element.html.erb" do
5
5
  describe "for simple display" do
@@ -7,9 +7,9 @@ describe "catalog/_constraints_element.html.erb" do
7
7
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value"}
8
8
  end
9
9
  it "should render label and value" do
10
- expect(rendered).to have_selector("span.appliedFilter.constraint") do |s|
11
- expect(s).to have_selector "span.filterName", :content => "my label"
12
- expect(s).to have_selector "span.filterValue", :content => "my value"
10
+ rendered.should have_selector("span.appliedFilter.constraint") do |s|
11
+ s.should have_selector "span.filterName", :content => "my label"
12
+ s.should have_selector "span.filterValue", :content => "my value"
13
13
  end
14
14
  end
15
15
  end
@@ -19,14 +19,14 @@ describe "catalog/_constraints_element.html.erb" do
19
19
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:remove => "http://remove"}}
20
20
  end
21
21
  it "should include remove link" do
22
- expect(rendered).to have_selector("span.appliedFilter") do |s|
23
- expect(s).to have_selector("a.btnRemove.imgReplace[href='http://remove']")
22
+ rendered.should have_selector("span.appliedFilter") do |s|
23
+ s.should have_selector(".remove[href='http://remove']")
24
24
  end
25
25
  end
26
26
 
27
27
  it "should have an accessible remove label" do
28
- expect(rendered).to have_selector("a.imgReplace") do |s|
29
- expect(s).to have_content("Remove constraint my label: my value")
28
+ rendered.should have_selector(".remove") do |s|
29
+ s.should have_content("Remove constraint my label: my value")
30
30
  end
31
31
  end
32
32
  end
@@ -36,8 +36,8 @@ describe "catalog/_constraints_element.html.erb" do
36
36
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:check => false}}
37
37
  end
38
38
  it "should not include checkmark" do
39
- expect(rendered).to have_selector("span.appliedFilter") do |s|
40
- expect(s).not_to have_selector("img[src$='checkmark.gif']")
39
+ rendered.should have_selector("span.appliedFilter") do |s|
40
+ s.should_not have_selector("img[src$='checkmark.gif']")
41
41
  end
42
42
  end
43
43
  end
@@ -47,7 +47,7 @@ describe "catalog/_constraints_element.html.erb" do
47
47
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:classes => ["class1", "class2"]}}
48
48
  end
49
49
  it "should include them" do
50
- expect(rendered).to have_selector("span.appliedFilter.constraint.class1.class2")
50
+ rendered.should have_selector("span.appliedFilter.constraint.class1.class2")
51
51
  end
52
52
  end
53
53
 
@@ -56,8 +56,8 @@ describe "catalog/_constraints_element.html.erb" do
56
56
  render( :partial => "catalog/constraints_element", :locals => {:label => "<span class='custom_label'>my label</span>", :value => "<span class='custom_value'>my value</span>", :options => {:escape_label => false, :escape_value => false}} )
57
57
  end
58
58
  it "should not escape key and value" do
59
- expect(rendered).to have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
60
- expect(rendered).to have_selector("span.appliedFilter.constraint span.filterValue span.custom_value")
59
+ rendered.should have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
60
+ rendered.should have_selector("span.appliedFilter.constraint span.filterValue span.custom_value")
61
61
  end
62
62
 
63
63
  end
@@ -10,7 +10,7 @@ describe "catalog/_document" do
10
10
  end
11
11
 
12
12
  it "should render the header, thumbnail and index" do
13
- allow(view).to receive(:blacklight_config).and_return(blacklight_config)
13
+ view.stub(:blacklight_config).and_return(blacklight_config)
14
14
  stub_template "catalog/_document_header.html.erb" => "document_header"
15
15
  stub_template "catalog/_thumbnail_default.html.erb" => "thumbnail_default"
16
16
  stub_template "catalog/_index_default.html.erb" => "index_default"
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'spec_helper'
3
3
 
4
4
  describe "/catalog/_document_list.html.erb" do
5
5
 
@@ -1,14 +1,14 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "catalog/_facets" do
4
4
  before do
5
5
  @mock_config = Blacklight::Configuration.new
6
- allow(view).to receive_messages(:blacklight_config => @mock_config)
6
+ view.stub(:blacklight_config => @mock_config)
7
7
  end
8
8
  it "should not have a header if no facets are displayed" do
9
- allow(view).to receive_messages(:render_facet_partials => '')
9
+ view.stub(:render_facet_partials => '')
10
10
  render
11
- expect(rendered).not_to have_selector('h4')
11
+ rendered.should_not have_selector('h4')
12
12
  end
13
13
 
14
14
  it "should have a header" do
@@ -16,15 +16,15 @@ describe "catalog/_facets" do
16
16
  @mock_field_1 = double(:field => 'facet_field_1',
17
17
  :label => 'label')
18
18
  @mock_display_facet_1 = double(:name => 'facet_field_1', :items => [Blacklight::SolrResponse::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
19
- allow(view).to receive_messages(:facet_field_names => [:facet_field_1],
19
+ view.stub(:facet_field_names => [:facet_field_1],
20
20
  :facet_limit_for => 10 )
21
21
 
22
22
  @response = double()
23
- allow(@response).to receive(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
23
+ @response.stub(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
24
24
 
25
- allow(view).to receive_messages(:render_facet_partials => '')
25
+ view.stub(:render_facet_partials => '')
26
26
  render
27
- expect(rendered).to have_selector('h4')
27
+ rendered.should have_selector('h4')
28
28
  end
29
29
 
30
30
  describe "facet display" do
@@ -32,24 +32,23 @@ describe "catalog/_facets" do
32
32
  @mock_field_1 = double(:field => 'facet_field_1',
33
33
  :label => 'label')
34
34
  @mock_display_facet_1 = double(:name => 'facet_field_1', :items => [Blacklight::SolrResponse::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
35
- allow(view).to receive_messages(:facet_field_names => [:facet_field_1],
35
+ view.stub(:facet_field_names => [:facet_field_1],
36
36
  :facet_limit_for => 10 )
37
37
 
38
38
  @response = double()
39
- allow(@response).to receive(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
39
+ @response.stub(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
40
40
 
41
41
  end
42
42
 
43
43
  it "should have a(n accessible) header" do
44
44
  render
45
- expect(rendered).to have_selector('h5')
46
- expect(rendered).to have_selector('h5 > a')
45
+ rendered.should have_selector('h5')
47
46
  end
48
47
 
49
48
  it "should list values" do
50
49
  render
51
- expect(rendered).to have_selector('a.facet_select')
52
- expect(rendered).to have_selector('.count')
50
+ rendered.should have_selector('a.facet_select')
51
+ rendered.should have_selector('.facet-count')
53
52
  end
54
53
 
55
54
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'spec_helper'
3
3
 
4
4
  # spec for default partial to display solr document fields
5
5
  # in catalog INDEX view
@@ -22,44 +22,44 @@ describe "/catalog/_index_default.erb" do
22
22
  @fname_4 = "four_field"
23
23
 
24
24
  @document = double("solr_doc")
25
- allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
26
- allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
27
- allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
28
- allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
25
+ @document.stub(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
26
+ @document.stub(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
27
+ @document.stub(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
28
+ @document.stub(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
29
29
 
30
- allow(@document).to receive(:has?).with(@fname_1).and_return(true)
31
- allow(@document).to receive(:has?).with(@fname_2).and_return(true)
32
- allow(@document).to receive(:has?).with(@fname_3).and_return(false)
33
- allow(@document).to receive(:has?).with(@fname_4).and_return(true)
30
+ @document.stub(:has?).with(@fname_1).and_return(true)
31
+ @document.stub(:has?).with(@fname_2).and_return(true)
32
+ @document.stub(:has?).with(@fname_3).and_return(false)
33
+ @document.stub(:has?).with(@fname_4).and_return(true)
34
34
 
35
35
  # cover any remaining fields in initalizer
36
- allow(@document).to receive(:[])
36
+ @document.stub(:[])
37
37
 
38
38
  @flabel_1 = "One:"
39
39
  @flabel_3 = "Three:"
40
40
  @flabel_4 = "Four:"
41
41
 
42
- allow(view).to receive(:blacklight_config).and_return(@config)
42
+ view.stub(:blacklight_config).and_return(@config)
43
43
  assigns[:document] = @document
44
44
  @rendered = view.render_document_partial @document, :index
45
45
  end
46
46
 
47
47
  it "should only display fields listed in the initializer" do
48
- expect(@rendered).not_to include_text("val_2")
49
- expect(@rendered).not_to include_text(@fname_2)
48
+ @rendered.should_not include_text("val_2")
49
+ @rendered.should_not include_text(@fname_2)
50
50
  end
51
51
 
52
52
  it "should skip over fields listed in initializer that are not in solr response" do
53
- expect(@rendered).not_to include_text(@fname_3)
53
+ @rendered.should_not include_text(@fname_3)
54
54
  end
55
55
 
56
56
  it "should display field labels from initializer and raw solr field names in the class" do
57
57
  # labels
58
- expect(@rendered).to include_text(@flabel_1)
59
- expect(@rendered).to include_text(@flabel_4)
58
+ @rendered.should include_text(@flabel_1)
59
+ @rendered.should include_text(@flabel_4)
60
60
  # classes
61
- expect(@rendered).to include_text("blacklight-#{@fname_1}")
62
- expect(@rendered).to include_text("blacklight-#{@fname_4}")
61
+ @rendered.should include_text("blacklight-#{@fname_1}")
62
+ @rendered.should include_text("blacklight-#{@fname_4}")
63
63
  end
64
64
 
65
65
  # this test probably belongs in a Cucumber feature
@@ -68,9 +68,9 @@ describe "/catalog/_index_default.erb" do
68
68
  # end
69
69
 
70
70
  it "should have values for displayed fields" do
71
- expect(@rendered).to include_text("val_1")
72
- expect(@rendered).to include_text("val_4")
73
- expect(@rendered).not_to include_text("val_2")
71
+ @rendered.should include_text("val_1")
72
+ @rendered.should include_text("val_4")
73
+ @rendered.should_not include_text("val_2")
74
74
  end
75
75
 
76
76
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'spec_helper'
3
3
 
4
4
  # spec for sidebar partial in catalog show view
5
5
 
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'spec_helper'
3
3
 
4
4
  # spec for default partial to display solr document fields
5
5
  # in catalog show view
@@ -24,44 +24,44 @@ describe "/catalog/_show_default.html.erb" do
24
24
  @fname_4 = "four_field"
25
25
 
26
26
  @document = double("solr_doc")
27
- allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
28
- allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
29
- allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
30
- allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
27
+ @document.stub(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
28
+ @document.stub(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
29
+ @document.stub(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
30
+ @document.stub(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
31
31
 
32
- allow(@document).to receive(:'has?').with(@fname_1).and_return(true)
33
- allow(@document).to receive(:'has?').with(@fname_2).and_return(true)
34
- allow(@document).to receive(:'has?').with(@fname_3).and_return(false)
35
- allow(@document).to receive(:'has?').with(@fname_4).and_return(true)
32
+ @document.stub(:'has?').with(@fname_1).and_return(true)
33
+ @document.stub(:'has?').with(@fname_2).and_return(true)
34
+ @document.stub(:'has?').with(@fname_3).and_return(false)
35
+ @document.stub(:'has?').with(@fname_4).and_return(true)
36
36
 
37
37
  # cover any remaining fields in initalizer
38
- allow(@document).to receive(:[])
38
+ @document.stub(:[])
39
39
 
40
40
  @flabel_1 = "One:"
41
41
  @flabel_3 = "Two:"
42
42
  @flabel_4 = "Four:"
43
43
 
44
- allow(view).to receive(:blacklight_config).and_return(@config)
44
+ view.stub(:blacklight_config).and_return(@config)
45
45
  assigns[:document] = @document
46
46
  @rendered = view.render_document_partial @document, :show
47
47
  end
48
48
 
49
49
  it "should only display fields listed in the initializer" do
50
- expect(@rendered).not_to include_text("val_2")
51
- expect(@rendered).not_to include_text(@fname_2)
50
+ @rendered.should_not include_text("val_2")
51
+ @rendered.should_not include_text(@fname_2)
52
52
  end
53
53
 
54
54
  it "should skip over fields listed in initializer that are not in solr response" do
55
- expect(@rendered).not_to include_text(@fname_3)
55
+ @rendered.should_not include_text(@fname_3)
56
56
  end
57
57
 
58
58
  it "should display field labels from initializer and raw solr field names in the class" do
59
59
  # labels
60
- expect(@rendered).to include_text(@flabel_1)
61
- expect(@rendered).to include_text(@flabel_4)
60
+ @rendered.should include_text(@flabel_1)
61
+ @rendered.should include_text(@flabel_4)
62
62
  # classes
63
- expect(@rendered).to include_text("blacklight-#{@fname_1}")
64
- expect(@rendered).to include_text("blacklight-#{@fname_4}")
63
+ @rendered.should include_text("blacklight-#{@fname_1}")
64
+ @rendered.should include_text("blacklight-#{@fname_4}")
65
65
  end
66
66
 
67
67
  # this test probably belongs in a Cucumber feature
@@ -70,9 +70,9 @@ describe "/catalog/_show_default.html.erb" do
70
70
  # end
71
71
 
72
72
  it "should have values for displayed fields" do
73
- expect(@rendered).to include_text("val_1")
74
- expect(@rendered).to include_text("val_4")
75
- expect(@rendered).not_to include_text("val_2")
73
+ @rendered.should include_text("val_1")
74
+ @rendered.should include_text("val_4")
75
+ @rendered.should_not include_text("val_2")
76
76
  end
77
77
 
78
78
  end