blacklight 3.8.2 → 4.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data/Gemfile +1 -0
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.js +12 -1
  5. data/app/assets/javascripts/blacklight/bootstrap_dropdowns.js +3 -0
  6. data/app/assets/javascripts/blacklight/checkbox_submit.js +12 -5
  7. data/app/assets/javascripts/blacklight/core.js +0 -1
  8. data/app/assets/javascripts/blacklight/css_dropdowns.js +10 -0
  9. data/app/assets/javascripts/blacklight/facet_expand_contract.js +5 -5
  10. data/app/assets/javascripts/blacklight/lightbox_dialog.js +68 -13
  11. data/app/assets/javascripts/blacklight/select_submit.js +19 -10
  12. data/app/assets/javascripts/improved-modal/bootstrap-modal.js +282 -0
  13. data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +353 -0
  14. data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +16 -5
  15. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +24 -6
  16. data/app/assets/stylesheets/blacklight/_catalog.css.scss +115 -141
  17. data/app/assets/stylesheets/blacklight/_dropdown.css.scss +57 -0
  18. data/app/assets/stylesheets/blacklight/_facets.css.scss +127 -58
  19. data/app/assets/stylesheets/blacklight/_footer.css.scss +20 -0
  20. data/app/assets/stylesheets/blacklight/_header.css.scss +90 -21
  21. data/app/assets/stylesheets/blacklight/_layout.css.scss +10 -9
  22. data/app/assets/stylesheets/blacklight/_modal.css.scss +23 -0
  23. data/app/assets/stylesheets/blacklight/_print.css.scss +0 -7
  24. data/app/assets/stylesheets/blacklight/_responsive.css.scss +3 -0
  25. data/app/assets/stylesheets/blacklight/_search_history.css.scss +2 -4
  26. data/app/assets/stylesheets/blacklight/blacklight.css.scss +0 -1
  27. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +9 -2
  28. data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.css.scss +5 -0
  29. data/app/assets/stylesheets/blacklight/responsive_partials/_facets.css.scss +37 -0
  30. data/app/assets/stylesheets/blacklight/responsive_partials/_header.css.scss +30 -0
  31. data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +199 -0
  32. data/app/controllers/bookmarks_controller.rb +16 -10
  33. data/app/helpers/blacklight/blacklight_helper_behavior.rb +124 -61
  34. data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -3
  35. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -9
  36. data/app/views/_flash_msg.html.erb +9 -4
  37. data/app/views/_user_util_links.html.erb +23 -17
  38. data/app/views/bookmarks/_tools.html.erb +7 -7
  39. data/app/views/bookmarks/index.html.erb +5 -13
  40. data/app/views/catalog/_bookmark_control.html.erb +2 -4
  41. data/app/views/catalog/_bookmark_form.html.erb +1 -1
  42. data/app/views/catalog/_citation.html.erb +21 -20
  43. data/app/views/catalog/_constraints.html.erb +8 -6
  44. data/app/views/catalog/_document_header.html.erb +6 -7
  45. data/app/views/catalog/_document_list.html.erb +1 -7
  46. data/app/views/catalog/_email_form.html.erb +42 -16
  47. data/app/views/catalog/_facet_layout.html.erb +1 -1
  48. data/app/views/catalog/_facet_limit.html.erb +1 -1
  49. data/app/views/catalog/_facet_pagination.html.erb +11 -14
  50. data/app/views/catalog/_facets.html.erb +16 -2
  51. data/app/views/catalog/_home.html.erb +2 -2
  52. data/app/views/catalog/_home_text.html.erb +5 -2
  53. data/app/views/catalog/_index_default.html.erb +2 -2
  54. data/app/views/catalog/_marc_view.html.erb +0 -1
  55. data/app/views/catalog/_paginate_compact.html.erb +5 -0
  56. data/app/views/catalog/_per_page_widget.html.erb +13 -7
  57. data/app/views/catalog/_previous_next_doc.html.erb +14 -4
  58. data/app/views/catalog/_refworks_form.html.erb +2 -2
  59. data/app/views/catalog/_results_pagination.html.erb +4 -1
  60. data/app/views/catalog/_search_form.html.erb +19 -13
  61. data/app/views/catalog/_show_default.html.erb +2 -2
  62. data/app/views/catalog/_show_more_like_this.html.erb +3 -0
  63. data/app/views/catalog/_show_sidebar.html.erb +14 -1
  64. data/app/views/catalog/_show_tools.html.erb +18 -18
  65. data/app/views/catalog/_sms_form.html.erb +35 -10
  66. data/app/views/catalog/_sort_and_per_page.html.erb +5 -3
  67. data/app/views/catalog/_sort_widget.html.erb +12 -6
  68. data/app/views/catalog/citation.html.erb +1 -1
  69. data/app/views/catalog/citation.js.erb +7 -0
  70. data/app/views/catalog/email.html.erb +5 -0
  71. data/app/views/catalog/facet.html.erb +28 -21
  72. data/app/views/catalog/index.html.erb +26 -26
  73. data/app/views/catalog/librarian_view.html.erb +7 -0
  74. data/app/views/catalog/show.html.erb +35 -29
  75. data/app/views/catalog/sms.html.erb +5 -0
  76. data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
  77. data/app/views/kaminari/blacklight/_gap.html.erb +4 -1
  78. data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
  79. data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
  80. data/app/views/kaminari/blacklight/_page.html.erb +4 -3
  81. data/app/views/kaminari/blacklight/_paginator.html.erb +5 -5
  82. data/app/views/kaminari/blacklight/_prev_page.html.erb +3 -3
  83. data/app/views/kaminari/blacklight_compact/_next_page.html.erb +9 -0
  84. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +15 -0
  85. data/app/views/kaminari/blacklight_compact/_prev_page.html.erb +9 -0
  86. data/app/views/layouts/blacklight.html.erb +47 -27
  87. data/app/views/saved_searches/index.html.erb +2 -2
  88. data/app/views/search_history/index.html.erb +12 -7
  89. data/app/views/shared/_footer.html.erb +0 -0
  90. data/app/views/shared/_header_navbar.html.erb +25 -0
  91. data/blacklight.gemspec +2 -5
  92. data/config/locales/blacklight.en.yml +23 -15
  93. data/lib/blacklight.rb +2 -2
  94. data/lib/blacklight/catalog.rb +36 -14
  95. data/lib/blacklight/configuration.rb +10 -2
  96. data/lib/blacklight/mash.rb +151 -0
  97. data/lib/blacklight/solr/document.rb +73 -11
  98. data/lib/blacklight/solr/document/extensions.rb +0 -8
  99. data/lib/blacklight/solr/document/marc_export.rb +7 -2
  100. data/lib/blacklight/solr/document/more_like_this.rb +5 -0
  101. data/lib/blacklight/solr_helper.rb +43 -18
  102. data/lib/blacklight/solr_response.rb +60 -0
  103. data/lib/blacklight/solr_response/facets.rb +58 -0
  104. data/lib/blacklight/solr_response/more_like_this.rb +14 -0
  105. data/lib/blacklight/solr_response/spelling.rb +92 -0
  106. data/lib/generators/blacklight/assets_generator.rb +1 -14
  107. data/lib/generators/blacklight/blacklight_generator.rb +22 -21
  108. data/lib/generators/blacklight/jetty_generator.rb +1 -35
  109. data/{test_support → lib/generators/blacklight/templates}/alternate_controller.rb +0 -0
  110. data/lib/generators/blacklight/templates/blacklight.css.scss +4 -0
  111. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +2 -2
  112. data/lib/generators/blacklight/templates/config/jetty.yml +6 -0
  113. data/lib/generators/blacklight/test_support_generator.rb +35 -0
  114. data/lib/railties/all_tests.rake +5 -23
  115. data/lib/railties/blacklight_cucumber.rake +2 -11
  116. data/lib/railties/blacklight_rspec.rake +2 -12
  117. data/test_support/bin/run-tests.sh +1 -1
  118. data/test_support/bin/setup-test-app.sh +123 -0
  119. data/test_support/bin/test.sh +21 -21
  120. data/test_support/features/bookmarks.feature +9 -3
  121. data/test_support/features/saved_searches.feature +3 -3
  122. data/test_support/features/search.feature +3 -3
  123. data/test_support/features/search_filters.feature +24 -26
  124. data/test_support/features/search_history.feature +9 -10
  125. data/test_support/features/search_sort.feature +4 -6
  126. data/test_support/features/step_definitions/general_steps.rb +0 -4
  127. data/test_support/features/step_definitions/search_result_steps.rb +2 -1
  128. data/test_support/features/step_definitions/search_steps.rb +32 -2
  129. data/test_support/spec/controllers/application_controller_spec.rb +8 -0
  130. data/test_support/spec/controllers/catalog_controller_spec.rb +3 -18
  131. data/test_support/spec/helpers/blacklight_helper_spec.rb +116 -20
  132. data/test_support/spec/helpers/catalog_helper_spec.rb +14 -6
  133. data/test_support/spec/helpers/facets_helper_spec.rb +1 -1
  134. data/test_support/spec/lib/blacklight_solr_document_more_like_this_spec.rb +18 -0
  135. data/test_support/spec/lib/blacklight_solr_document_spec.rb +54 -1
  136. data/test_support/spec/lib/blacklight_solr_response_spec.rb +153 -0
  137. data/test_support/spec/lib/facet_paginator_spec.rb +1 -1
  138. data/test_support/spec/lib/marc_export_spec.rb +14 -6
  139. data/test_support/spec/lib/solr_helper_spec.rb +22 -6
  140. data/test_support/spec/models/solr_docment_spec.rb +1 -4
  141. data/test_support/spec/{features → requests}/alternate_controller_spec.rb +3 -2
  142. data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +20 -4
  143. data/test_support/spec/views/catalog/_show_sidebar.erb_spec.rb +25 -0
  144. metadata +53 -131
  145. data/app/assets/javascripts/blacklight/more_facets.js +0 -16
  146. data/app/assets/javascripts/jquery-1.4.2.min.js +0 -154
  147. data/app/assets/javascripts/jquery-ui-1.8.1.custom.min.js +0 -756
  148. data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +0 -180
  149. data/app/assets/stylesheets/blacklight/_formatting.css.scss +0 -164
  150. data/app/assets/stylesheets/blacklight/grids/_susy_grid.css.scss +0 -72
  151. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  152. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  153. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  154. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  155. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  156. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  157. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  158. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
  159. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  160. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  161. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  162. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  163. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
  164. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  165. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  166. data/app/assets/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +0 -486
  167. data/app/models/solr_document.rb +0 -5
  168. data/app/views/catalog/email.erb +0 -1
  169. data/app/views/catalog/sms.erb +0 -1
  170. data/doc/Atom-Responses.md +0 -90
  171. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
  172. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
  173. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
  174. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
  175. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
  176. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -78
  177. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
  178. data/doc/Blacklight-Add-ons.md +0 -28
  179. data/doc/Blacklight-configuration.md +0 -301
  180. data/doc/Blacklight-on-Heroku.md +0 -135
  181. data/doc/Community-principles.md +0 -44
  182. data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
  183. data/doc/Contributing-to-Blacklight.md +0 -25
  184. data/doc/Examples.md +0 -62
  185. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  186. data/doc/Home.md +0 -77
  187. data/doc/How-to-release-a-version.md +0 -37
  188. data/doc/Indexing-your-data-into-solr.md +0 -5
  189. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  190. data/doc/Pagination.md +0 -38
  191. data/doc/Providing-your-own-view-templates.md +0 -109
  192. data/doc/Quickstart.md +0 -116
  193. data/doc/README.md +0 -77
  194. data/doc/README_SOLR.md +0 -245
  195. data/doc/Release-Notes-And-Upgrade-Guides.md +0 -14
  196. data/doc/Sunspot-for-indexing.md +0 -46
  197. data/doc/User-Authentication.md +0 -60
  198. data/doc/testing.md +0 -115
  199. data/lib/generators/blacklight/solr_conf_generator.rb +0 -26
  200. data/lib/generators/blacklight/templates/assets/standard.css.scss +0 -59
  201. data/lib/generators/blacklight/templates/config/blacklight_config.rb +0 -3
  202. data/lib/generators/blacklight/templates/config/compass.rb +0 -2
  203. data/lib/generators/blacklight/templates/solr_conf/schema.xml +0 -689
  204. data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +0 -1846
  205. data/lib/solrmarc.log.1 +0 -849
  206. data/test_support/spec/controllers/bookmarks_controller_spec.rb +0 -48
@@ -10,7 +10,7 @@ describe CatalogHelper do
10
10
  total = args[:total]
11
11
  start = (current_page - 1) * per_page
12
12
 
13
- mock_response = mock("RSolr::Ext::Response")
13
+ mock_response = mock("Blacklight::SolrResponse")
14
14
  mock_response.stub!(:total).and_return(total)
15
15
  mock_response.stub!(:rows).and_return(per_page)
16
16
  mock_response.stub!(:start).and_return(start)
@@ -31,11 +31,19 @@ describe CatalogHelper do
31
31
  html.html_safe?.should == true
32
32
  end
33
33
 
34
+ it "with no results (and no entry_name provided)" do
35
+ @response = mock_response :total => 0
36
+
37
+ html = render_pagination_info(@response)
38
+ html.should == "No entries found"
39
+ html.html_safe?.should == true
40
+ end
41
+
34
42
  it "with a single result" do
35
43
  @response = mock_response :total => 1
36
44
 
37
45
  html = render_pagination_info(@response, { :entry_name => 'entry_name' })
38
- html.should == "Displaying <b>1</b> entry_name"
46
+ html.should == "<b>1</b> to <b>1</b> of <b>1</b>"
39
47
  html.html_safe?.should == true
40
48
  end
41
49
 
@@ -43,7 +51,7 @@ describe CatalogHelper do
43
51
  @response = mock_response :total => 7
44
52
 
45
53
  html = render_pagination_info(@response, { :entry_name => 'entry_name' })
46
- html.should == "Displaying <b>all 7</b> entry_names"
54
+ html.should == "<b>1</b> - <b>7</b> of <b>7</b>"
47
55
  html.html_safe?.should == true
48
56
  end
49
57
 
@@ -51,7 +59,7 @@ describe CatalogHelper do
51
59
  @response = mock_response :total => 15, :per_page => 10
52
60
 
53
61
  html = render_pagination_info(@response, { :entry_name => 'entry_name' })
54
- html.should == "Displaying entry_names <b>1 - 10</b> of <b>15</b>"
62
+ html.should == "<b>1</b> - <b>10</b> of <b>15</b>"
55
63
  html.html_safe?.should == true
56
64
  end
57
65
 
@@ -59,7 +67,7 @@ describe CatalogHelper do
59
67
  @response = mock_response :total => 47, :per_page => 10, :current_page => 2
60
68
 
61
69
  html = render_pagination_info(@response, { :entry_name => 'entry_name' })
62
- html.should == "Displaying entry_names <b>11 - 20</b> of <b>47</b>"
70
+ html.should == "<b>11</b> - <b>20</b> of <b>47</b>"
63
71
  html.html_safe?.should == true
64
72
  end
65
73
 
@@ -67,7 +75,7 @@ describe CatalogHelper do
67
75
  @response = mock_response :total => 47, :per_page => 10, :current_page => 5
68
76
 
69
77
  html = render_pagination_info(@response, { :entry_name => 'entry_name' })
70
- html.should == "Displaying entry_names <b>41 - 47</b> of <b>47</b>"
78
+ html.should == "<b>41</b> - <b>47</b> of <b>47</b>"
71
79
  html.html_safe?.should == true
72
80
  end
73
81
 
@@ -94,7 +94,7 @@ describe FacetsHelper do
94
94
 
95
95
  it"should convert the query facets into a mock RSolr FacetField" do
96
96
  field = helper.facet_by_field_name('my_query_facet_field')
97
- field.should be_a_kind_of RSolr::Ext::Response::Facets::FacetField
97
+ field.should be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
98
98
 
99
99
  field.name.should == 'my_query_facet_field'
100
100
  field.items.length.should == 2
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Blacklight::Solr::Document::MoreLikeThis do
4
+ before(:all) do
5
+ @mock_class = Class.new do
6
+ include Blacklight::Solr::Document
7
+ end
8
+ end
9
+
10
+ it "should pluck the MoreLikeThis results from the Solr Response" do
11
+ mock_solr_response = mock(:more_like => [{'id' => 'abc'}])
12
+ result = @mock_class.new({:id => '123'}, mock_solr_response).more_like_this
13
+ result.should have(1).item
14
+ result.first.should be_a_kind_of(SolrDocument)
15
+ result.first.id.should == 'abc'
16
+ result.first.solr_response.should == mock_solr_response
17
+ end
18
+ end
@@ -18,11 +18,31 @@ describe "Blacklight::Solr::Document" do
18
18
  "override"
19
19
  end
20
20
  end
21
+
22
+ context "Hashy methods" do
23
+ it 'should create a doc with hashy methods' do
24
+ doc = SolrDocument.new({'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']})
25
+
26
+ doc.has?(:cat, /^elec/).should == true
27
+ doc.has?(:cat, 'elec').should_not == true
28
+ doc.has?(:cat, 'electronics').should == true
29
+
30
+ doc.get(:cat).should == 'electronics, hard drive'
31
+ doc.get(:xyz).should == nil
32
+ doc.get(:xyz, :default=>'def').should == 'def'
33
+ end
34
+ end
35
+
21
36
 
22
37
  context "Unique Key" do
23
- it "should use a configuration-defined document unique key" do
38
+ before(:each) do
24
39
  MockDocument.unique_key = 'my_unique_key'
40
+ end
25
41
 
42
+ after(:each) do
43
+ MockDocument.unique_key = 'id'
44
+ end
45
+ it "should use a configuration-defined document unique key" do
26
46
  @document = MockDocument.new :id => 'asdf', :my_unique_key => '1234'
27
47
  @document.id.should == '1234'
28
48
  end
@@ -178,5 +198,38 @@ describe "Blacklight::Solr::Document" do
178
198
 
179
199
  end
180
200
 
201
+ context "highlighting" do
202
+
203
+ before(:all) do
204
+ @document = MockDocument.new({'id' => 'doc1', 'title_field' => 'doc1 title'}, {'highlighting' => { 'doc1' => { 'title_text' => ['doc <em>1</em>']}, 'doc2' => { 'title_text' => ['doc 2']}}})
205
+
206
+ end
207
+
208
+ describe "#has_highlight_field?" do
209
+ it "should be true if the highlight field is in the solr response" do
210
+ @document.should have_highlight_field 'title_text'
211
+ @document.should have_highlight_field :title_text
212
+ end
213
+
214
+ it "should be false if the highlight field isn't in the solr response" do
215
+ @document.should_not have_highlight_field 'nonexisting_field'
216
+ end
217
+ end
218
+
219
+ describe "#highlight_field" do
220
+ it "should return a value" do
221
+ @document.highlight_field('title_text').should include('doc <em>1</em>')
222
+ end
223
+
224
+
225
+ it "should return a value that is html safe" do
226
+ @document.highlight_field('title_text').first.should be_html_safe
227
+ end
228
+
229
+ it "should return nil when the field doesn't exist" do
230
+ @document.highlight_field('nonexisting_field').should be_nil
231
+ end
232
+ end
233
+ end
181
234
 
182
235
  end
@@ -0,0 +1,153 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require 'blacklight'
3
+
4
+ describe Blacklight::SolrResponse do
5
+
6
+ def create_response
7
+ raw_response = eval(mock_query_response)
8
+ Blacklight::SolrResponse.new(raw_response, raw_response['params'])
9
+ end
10
+
11
+ it 'should create a valid response' do
12
+ r = create_response
13
+ r.should respond_to(:header)
14
+ end
15
+
16
+ it 'should have accurate pagination numbers' do
17
+ r = create_response
18
+ r.rows.should == 11
19
+ r.total.should == 26
20
+ r.start.should == 0
21
+ end
22
+
23
+ it 'should create a valid response class' do
24
+ r = create_response
25
+
26
+ r.should respond_to(:response)
27
+ r.docs.size.should == 11
28
+ r.params[:echoParams].should == 'EXPLICIT'
29
+
30
+ r.should be_a(Blacklight::SolrResponse::Facets)
31
+ end
32
+
33
+ it 'should provide facet helpers' do
34
+ r = create_response
35
+ r.facets.size.should == 2
36
+
37
+ field_names = r.facets.collect{|facet|facet.name}
38
+ field_names.include?('cat').should == true
39
+ field_names.include?('manu').should == true
40
+
41
+ first_facet = r.facets.select { |x| x.name == 'cat'}.first
42
+ first_facet.name.should == 'cat'
43
+
44
+ first_facet.items.size.should == 10
45
+
46
+ expected = "electronics - 14, memory - 3, card - 2, connector - 2, drive - 2, graphics - 2, hard - 2, monitor - 2, search - 2, software - 2"
47
+ received = first_facet.items.collect do |item|
48
+ item.value + ' - ' + item.hits.to_s
49
+ end.join(', ')
50
+
51
+ received.should == expected
52
+
53
+ r.facets.each do |facet|
54
+ facet.respond_to?(:name).should == true
55
+ facet.items.each do |item|
56
+ item.respond_to?(:value).should == true
57
+ item.respond_to?(:hits).should == true
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ it 'should return the correct value when calling facet_by_field_name' do
64
+ r = create_response
65
+ facet = r.facet_by_field_name('cat')
66
+ facet.name.should == 'cat'
67
+ end
68
+
69
+ it 'should provide the responseHeader params' do
70
+ raw_response = eval(mock_query_response)
71
+ raw_response['responseHeader']['params']['test'] = :test
72
+ r = Blacklight::SolrResponse.new(raw_response, raw_response['params'])
73
+ r.params['test'].should == :test
74
+ end
75
+
76
+ it 'should provide the solr-returned params and "rows" should be 11' do
77
+ raw_response = eval(mock_query_response)
78
+ r = Blacklight::SolrResponse.new(raw_response, {})
79
+ r.params[:rows].to_s.should == '11'
80
+ end
81
+
82
+ it 'should provide the ruby request params if responseHeader["params"] does not exist' do
83
+ raw_response = eval(mock_query_response)
84
+ raw_response.delete 'responseHeader'
85
+ r = Blacklight::SolrResponse.new(raw_response, :rows => 999)
86
+ r.params[:rows].to_s.should == '999'
87
+ end
88
+
89
+ it 'should provide spelling suggestions for regular spellcheck results' do
90
+ raw_response = eval(mock_response_with_spellcheck)
91
+ r = Blacklight::SolrResponse.new(raw_response, {})
92
+ r.spelling.words.should include("dell")
93
+ r.spelling.words.should include("ultrasharp")
94
+ end
95
+
96
+ it 'should provide spelling suggestions for extended spellcheck results' do
97
+ raw_response = eval(mock_response_with_spellcheck_extended)
98
+ r = Blacklight::SolrResponse.new(raw_response, {})
99
+ r.spelling.words.should include("dell")
100
+ r.spelling.words.should include("ultrasharp")
101
+ end
102
+
103
+ it 'should provide no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
104
+ raw_response = eval(mock_response_with_spellcheck_same_frequency)
105
+ r = Blacklight::SolrResponse.new(raw_response, {})
106
+ r.spelling.words.should == []
107
+ end
108
+
109
+ it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
110
+ raw_response = eval(mock_response_with_spellcheck_collation)
111
+ r = Blacklight::SolrResponse.new(raw_response, {})
112
+ r.spelling.words.should include("dell")
113
+ r.spelling.words.should include("ultrasharp")
114
+ end
115
+
116
+ it 'should provide spelling suggestion collation' do
117
+ raw_response = eval(mock_response_with_spellcheck_collation)
118
+ r = Blacklight::SolrResponse.new(raw_response, {})
119
+ r.spelling.collation.should == 'dell ultrasharp'
120
+ end
121
+
122
+ it "should provide MoreLikeThis suggestions" do
123
+ raw_response = eval(mock_response_with_more_like_this)
124
+ r = Blacklight::SolrResponse.new(raw_response, {})
125
+ r.more_like(mock(:id => '79930185')).should have(2).items
126
+ end
127
+
128
+ def mock_query_response
129
+ %({'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'facet.limit'=>'10','wt'=>'ruby','rows'=>'11','facet'=>'true','facet.field'=>['cat','manu'],'echoParams'=>'EXPLICIT','q'=>'*:*','facet.sort'=>'true'}},'response'=>{'numFound'=>26,'start'=>0,'docs'=>[{'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},{'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2009-03-20T14:42:49.877Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},{'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2009-03-20T14:42:49.937Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},{'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2009-03-20T14:42:49.944Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},{'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2009-03-20T14:42:49.962Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},{'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2009-03-20T14:42:49.99Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},{'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2009-03-20T14:42:50Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},{'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2009-03-20T14:42:50.004Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},{'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2009-03-20T14:42:50.017Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},{'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2009-03-20T14:42:50.034Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']},{'id'=>'0579B002','inStock'=>true,'manu'=>'Canon Inc.','name'=>'Canon PIXMA MP500 All-In-One Photo Printer','popularity'=>6,'price'=>179.99,'sku'=>'0579B002','timestamp'=>'2009-03-20T14:42:50.062Z','weight'=>352.0,'cat'=>['electronics','multifunction printer','printer','scanner','copier'],'spell'=>['Canon PIXMA MP500 All-In-One Photo Printer'],'features'=>['Multifunction ink-jet color photo printer','Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi','2.5" color LCD preview screen','Duplex Copying','Printing speed up to 29ppm black, 19ppm color','Hi-Speed USB','memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard']}]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'cat'=>['electronics',14,'memory',3,'card',2,'connector',2,'drive',2,'graphics',2,'hard',2,'monitor',2,'search',2,'software',2],'manu'=>['inc',8,'apach',2,'belkin',2,'canon',2,'comput',2,'corp',2,'corsair',2,'foundat',2,'microsystem',2,'softwar',2]},'facet_dates'=>{}}})
130
+ end
131
+
132
+ # These spellcheck responses are all Solr 1.4 responses
133
+ def mock_response_with_spellcheck
134
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}}|
135
+ end
136
+
137
+ def mock_response_with_spellcheck_extended
138
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>0,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>0,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}}|
139
+ end
140
+
141
+ def mock_response_with_spellcheck_same_frequency
142
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>1,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashard',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>1,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}}|
143
+ end
144
+
145
+ # it can be the case that extended results are off and collation is on
146
+ def mock_response_with_spellcheck_collation
147
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}}|
148
+ end
149
+
150
+ def mock_response_with_more_like_this
151
+ %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'subject_t','fl'=>'id','mlt.count'=>'3','mlt.mintf'=>'0','mlt'=>'true','q.alt'=>'*:*','qt'=>'search','wt'=>'ruby'}},'response'=>{'numFound'=>30,'start'=>0,'docs'=>[{'id'=>'00282214'},{'id'=>'00282371'},{'id'=>'00313831'},{'id'=>'00314247'},{'id'=>'43037890'},{'id'=>'53029833'},{'id'=>'77826928'},{'id'=>'78908283'},{'id'=>'79930185'},{'id'=>'85910001'}]},'moreLikeThis'=>{'00282214'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00282371'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00313831'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'96933325'}]},'00314247'=>{'numFound'=>3,'start'=>0,'docs'=>[{'id'=>'2008543486'},{'id'=>'96933325'},{'id'=>'2009373513'}]},'43037890'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'53029833'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'77826928'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'94120425'}]},'78908283'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'79930185'=>{'numFound'=>2,'start'=>0,'docs'=>[{'id'=>'94120425'},{'id'=>'2007020969'}]},'85910001'=>{'numFound'=>0,'start'=>0,'docs'=>[]}}})
152
+ end
153
+ end
@@ -6,7 +6,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
6
6
  describe 'Blacklight::Solr::FacetPaginator' do
7
7
  before(:all) do
8
8
  require 'yaml'
9
- @seven_facet_values = YAML::load("--- \n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 792\n value: Book\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 65\n value: Musical Score\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 58\n value: Serial\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 48\n value: Musical Recording\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 37\n value: Microform\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 27\n value: Thesis\n- !ruby/object:RSolr::Ext::Response::Facets::FacetItem \n hits: 0\n value: \n")
9
+ @seven_facet_values = YAML::load("--- \n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 792\n value: Book\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 65\n value: Musical Score\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 58\n value: Serial\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 48\n value: Musical Recording\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 37\n value: Microform\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 27\n value: Thesis\n- !ruby/object:Blacklight::SolrResponse::Facets::FacetItem \n hits: 0\n value: \n")
10
10
  @six_facet_values = @seven_facet_values.slice(1,6)
11
11
  @limit = 6
12
12
 
@@ -1,4 +1,4 @@
1
- # -*- encoding : utf-8 -*-
1
+ # -*- encoding : utf-8 -*-
2
2
  # -*- coding: utf-8 -*-
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
4
4
  require 'rubygems'
@@ -676,12 +676,20 @@ describe Blacklight::Solr::Document::MarcExport do
676
676
  @music_record.export_as_refworks_marc_txt.should == "LEADER 01828cjm a2200409 a 4500001 a4768316\n003 SIRSI\n007 sd fungnnmmned\n008 020117p20011990xxuzz h d\n245 00 Music for horn |h[sound recording] / |cBrahms, Beethoven, von Krufft.\n260 [United States] : |bHarmonia Mundi USA, |cp2001.\n700 1 Greer, Lowell.\n700 1 Lubin, Steven.\n700 1 Chase, Stephanie, |d1957-\n700 12 Brahms, Johannes, |d1833-1897. |tTrios, |mpiano, violin, horn, |nop. 40, |rE? major.\n700 12 Beethoven, Ludwig van, |d1770-1827. |tSonatas, |mhorn, piano, |nop. 17, |rF major.\n700 12 Krufft, Nikolaus von, |d1779-1818. |tSonata, |mhorn, piano, |rF major.\n"
677
677
  end
678
678
  describe "for UTF-8 record" do
679
- before do
680
- @utf8_exported = @record_utf8_decomposed.export_as_refworks_marc_txt
681
- end
682
679
  it "should export in Unicode normalized C form" do
683
- @utf8_exported.should_not include("\314\204\312\273") # decomposed
684
- @utf8_exported.should include("\304\253\312\273") # C-form normalized
680
+
681
+ begin
682
+ require 'unicode'
683
+ rescue LoadError
684
+ Blacklight.logger.should_receive(:warn) unless defined? :JRUBY_VERSION
685
+ end
686
+
687
+ @utf8_exported = @record_utf8_decomposed.export_as_refworks_marc_txt
688
+
689
+ if defined? Unicode
690
+ @utf8_exported.should_not include("\314\204\312\273") # decomposed
691
+ @utf8_exported.should include("\304\253\312\273") # C-form normalized
692
+ end
685
693
  end
686
694
  end
687
695
  end
@@ -546,9 +546,13 @@ describe 'Blacklight::SolrHelper' do
546
546
  end
547
547
 
548
548
  it "should use the configured request handler " do
549
- require 'ostruct'
550
549
  blacklight_config.stub(:solr_request_handler => 'custom_request_handler')
551
- self.should_receive(:find).with('custom_request_handler', anything).and_return(OpenStruct.new( :docs => [{}] ))
550
+ Blacklight.solr.should_receive(:paginate) do |page, rows, path, params|
551
+ page.should == 1
552
+ rows.should == 10
553
+ path.should == 'select'
554
+ params[:params].should include(:qt=>"custom_request_handler", :q=>"", "spellcheck.q"=>"", :"facet.field"=>["format", "{!ex=pub_date_single}pub_date", "subject_topic_facet", "language_facet", "lc_1letter_facet", "subject_geo_facet", "subject_era_facet"], :"facet.query"=>["pub_date:[2007 TO *]", "pub_date:[2002 TO *]", "pub_date:[1987 TO *]"], :"f.subject_topic_facet.facet.limit"=>21, :sort=>"score desc, pub_date_sort desc, title_sort asc")
555
+ end.and_return({'response'=>{'docs'=>[]}})
552
556
  get_search_results(:q => @all_docs_query)
553
557
  end
554
558
 
@@ -570,6 +574,13 @@ describe 'Blacklight::SolrHelper' do
570
574
  end
571
575
  end
572
576
 
577
+ describe '#query_solr' do
578
+ it 'should have results' do
579
+ solr_response = query_solr(:q => @single_word_query)
580
+ solr_response.docs.size.should > 0
581
+ end
582
+ end
583
+
573
584
  describe 'for All Docs Query, No Facets' do
574
585
  it 'should have non-nil values for required doc fields set in initializer' do
575
586
  (solr_response, document_list) = get_search_results(:q => @all_docs_query)
@@ -583,6 +594,12 @@ describe 'Blacklight::SolrHelper' do
583
594
 
584
595
 
585
596
  describe "Single Word Query with no Facets" do
597
+
598
+ it 'should have results' do
599
+ solr_response = query_solr(:q => @single_word_query)
600
+ solr_response.docs.size.should > 0
601
+ end
602
+
586
603
  it 'should have results' do
587
604
  (solr_response, document_list) = get_search_results(:q => @single_word_query)
588
605
  solr_response.docs.size.should == document_list.size
@@ -781,10 +798,9 @@ describe 'Blacklight::SolrHelper' do
781
798
  end
782
799
 
783
800
  it "should use a provided document request handler " do
784
- require 'ostruct'
785
801
  blacklight_config.stub(:document_solr_request_handler => 'document')
786
- self.should_receive(:find).with('document', anything).and_return(OpenStruct.new( :docs => [{}] ))
787
- get_solr_response_for_doc_id(@doc_id)
802
+ Blacklight.solr.should_receive(:get).with('select', kind_of(Hash)).and_return({'response'=>{'docs'=>[]}})
803
+ lambda { get_solr_response_for_doc_id(@doc_id)}.should raise_error Blacklight::Exceptions::InvalidSolrID
788
804
  end
789
805
 
790
806
  it "should have a non-nil result for a known id" do
@@ -1013,7 +1029,7 @@ describe 'Blacklight::SolrHelper' do
1013
1029
  # more like this
1014
1030
  # nearby on shelf
1015
1031
  it "should raise a Blacklight exception if RSolr can't connect to the Solr instance" do
1016
- Blacklight.solr.stub!(:find).and_raise(Errno::ECONNREFUSED)
1032
+ Blacklight.solr.stub!(:get).and_raise(Errno::ECONNREFUSED)
1017
1033
  expect { find(:a => 123) }.to raise_exception(/Unable to connect to Solr instance/)
1018
1034
  end
1019
1035
  end
@@ -9,9 +9,6 @@ require 'marc'
9
9
  # values in an after() block so other tests get expected results.
10
10
  # Blacklight is a Singleton for application configuration.
11
11
 
12
- # NOTE the helper methods below that return hashes and call to_mash.
13
- # this will NOT be needed if using RSolr::Ext >= version 0.9.6.3
14
-
15
12
  ## TODO: ALL these specs probably really ought to be on the modules
16
13
  # being tested, not on the bare SolrDocument class that has no logic
17
14
  # of it's own, it just includes modules. No? jrochkind 29 Mar 2010
@@ -47,7 +44,7 @@ end
47
44
  # count on the initializer to register the extension, need to re-register
48
45
  # it.
49
46
  SolrDocument.registered_extensions = nil
50
- SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) { |document| document.key?(:marc_display)}
47
+ SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) { |document| document.has_key?(:marc_display)}
51
48
 
52
49
  @solrdoc = SolrDocument.new(@hash_with_marcxml)
53
50
 
@@ -4,12 +4,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
4
4
  describe "controllers that are not catalog controller" do
5
5
 
6
6
  it "should have the correct search form" do
7
+ pending
7
8
  visit alternate_index_path
8
9
  page.should have_selector("form[action='#{alternate_index_path}']")
9
10
  fill_in "q", :with=>"history"
10
11
  click_button 'search'
11
- page.should have_link("startOverLink", :href=>alternate_index_path)
12
+ # page.should have_link("startOverLink", :href=>alternate_index_path)
12
13
  page.should have_selector("form.per_page[action='#{alternate_index_path}']")
13
- page.should have_selector("form#sort_form[action='#{alternate_index_path}']")
14
+ page.should have_selector("form.sort[action='#{alternate_index_path}']")
14
15
  end
15
16
  end