blacklight 4.7.0 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +13 -12
  4. data/Gemfile +37 -2
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/{_blacklight_base.css.scss → _blacklight_base.scss} +0 -0
  7. data/app/assets/stylesheets/blacklight/{_bookmark.css.scss → _bookmark.scss} +0 -0
  8. data/app/assets/stylesheets/blacklight/{_catalog.css.scss → _catalog.scss} +0 -0
  9. data/app/assets/stylesheets/blacklight/{_dropdown.css.scss → _dropdown.scss} +0 -0
  10. data/app/assets/stylesheets/blacklight/{_facets.css.scss → _facets.scss} +0 -0
  11. data/app/assets/stylesheets/blacklight/{_footer.css.scss → _footer.scss} +0 -0
  12. data/app/assets/stylesheets/blacklight/{_group.css.scss → _group.scss} +0 -0
  13. data/app/assets/stylesheets/blacklight/{_header.css.scss → _header.scss} +0 -0
  14. data/app/assets/stylesheets/blacklight/{_layout.css.scss → _layout.scss} +0 -0
  15. data/app/assets/stylesheets/blacklight/{_mixins.css.scss → _mixins.scss} +0 -0
  16. data/app/assets/stylesheets/blacklight/{_modal.css.scss → _modal.scss} +0 -0
  17. data/app/assets/stylesheets/blacklight/{_print.css.scss → _print.scss} +0 -0
  18. data/app/assets/stylesheets/blacklight/{_responsive.css.scss → _responsive.scss} +0 -0
  19. data/app/assets/stylesheets/blacklight/{_search_history.css.scss → _search_history.scss} +0 -0
  20. data/app/assets/stylesheets/blacklight/{blacklight.css.scss → blacklight.scss} +0 -0
  21. data/app/assets/stylesheets/blacklight/{blacklight_defaults.css.scss → blacklight_defaults.scss} +0 -0
  22. data/app/assets/stylesheets/blacklight/responsive_partials/{_catalog.css.scss → _catalog.scss} +0 -0
  23. data/app/assets/stylesheets/blacklight/responsive_partials/{_facets.css.scss → _facets.scss} +0 -0
  24. data/app/assets/stylesheets/blacklight/responsive_partials/{_header.css.scss → _header.scss} +0 -0
  25. data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -2
  26. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
  27. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -0
  28. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
  29. data/blacklight.gemspec +5 -6
  30. data/lib/blacklight/catalog.rb +1 -1
  31. data/lib/blacklight/catalog/search_context.rb +6 -6
  32. data/lib/blacklight/solr/document.rb +29 -21
  33. data/lib/blacklight/solr_helper.rb +6 -4
  34. data/lib/generators/blacklight/templates/{blacklight.css.scss → blacklight.scss} +0 -0
  35. data/spec/controllers/application_controller_spec.rb +3 -3
  36. data/spec/controllers/bookmarks_controller_spec.rb +11 -11
  37. data/spec/controllers/catalog_controller_spec.rb +117 -117
  38. data/spec/controllers/search_history_controller_spec.rb +8 -8
  39. data/spec/features/alternate_controller_spec.rb +7 -5
  40. data/spec/features/record_view_spec.rb +4 -1
  41. data/spec/features/search_filters_spec.rb +37 -24
  42. data/spec/features/search_pagination_spec.rb +11 -7
  43. data/spec/features/search_results_spec.rb +22 -14
  44. data/spec/features/search_sort_spec.rb +3 -1
  45. data/spec/features/search_spec.rb +6 -0
  46. data/spec/helpers/blacklight_helper_spec.rb +175 -166
  47. data/spec/helpers/catalog_helper_spec.rb +59 -59
  48. data/spec/helpers/facets_helper_spec.rb +118 -118
  49. data/spec/helpers/hash_as_hidden_fields_spec.rb +14 -8
  50. data/spec/helpers/html_head_helper_spec.rb +51 -45
  51. data/spec/helpers/render_constraints_helper_spec.rb +5 -6
  52. data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
  53. data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
  54. data/spec/lib/blacklight_configurable_spec.rb +16 -16
  55. data/spec/lib/blacklight_configuration_spec.rb +132 -132
  56. data/spec/lib/blacklight_email_spec.rb +4 -4
  57. data/spec/lib/blacklight_sms_spec.rb +4 -4
  58. data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
  59. data/spec/lib/blacklight_solr_document_marc_spec.rb +3 -3
  60. data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
  61. data/spec/lib/blacklight_solr_document_spec.rb +36 -36
  62. data/spec/lib/blacklight_solr_response_spec.rb +42 -42
  63. data/spec/lib/blacklight_spec.rb +5 -5
  64. data/spec/lib/blacklight_user_spec.rb +5 -5
  65. data/spec/lib/facet_paginator_spec.rb +12 -12
  66. data/spec/lib/marc_export_spec.rb +746 -746
  67. data/spec/lib/search_fields_spec.rb +13 -13
  68. data/spec/lib/solr_helper_spec.rb +255 -250
  69. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  70. data/spec/lib/tasks/solr_marc_task_spec.rb +6 -6
  71. data/spec/lib/utils_spec.rb +11 -11
  72. data/spec/models/bookmark_spec.rb +7 -6
  73. data/spec/models/record_mailer_spec.rb +16 -16
  74. data/spec/models/search_spec.rb +8 -8
  75. data/spec/models/solr_document_spec.rb +7 -7
  76. data/spec/requests/alternate_controller_spec.rb +3 -3
  77. data/spec/routing/catalog_routing_spec.rb +10 -15
  78. data/spec/spec_helper.rb +6 -4
  79. data/spec/support/assert_difference.rb +2 -2
  80. data/spec/support/features.rb +11 -0
  81. data/spec/support/features/session_helpers.rb +3 -3
  82. data/spec/support/include_text.rb +2 -2
  83. data/spec/test_app_templates/Gemfile.extra +2 -15
  84. data/spec/test_app_templates/lib/generators/test_app_generator.rb +17 -6
  85. data/spec/views/catalog/_constraints.html.erb_spec.rb +7 -7
  86. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +12 -12
  87. data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
  88. data/spec/views/catalog/_facets.html.erb_spec.rb +13 -13
  89. data/spec/views/catalog/_index_default.erb_spec.rb +20 -20
  90. data/spec/views/catalog/_show_default.erb_spec.rb +20 -20
  91. data/spec/views/catalog/_show_sidebar.erb_spec.rb +6 -6
  92. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
  93. data/spec/views/catalog/index.atom.builder_spec.rb +28 -28
  94. data/spec/views/catalog/index.html.erb_spec.rb +6 -6
  95. metadata +35 -57
  96. data/gemfiles/rails3.gemfile +0 -25
  97. data/gemfiles/rails4.gemfile +0 -24
@@ -11,10 +11,10 @@ describe CatalogHelper do
11
11
  start = (current_page - 1) * per_page
12
12
 
13
13
  mock_docs = (1..total).to_a.map { {}.with_indifferent_access }
14
-
14
+
15
15
  mock_response = Kaminari.paginate_array(mock_docs).page(current_page).per(per_page)
16
16
 
17
- mock_response.stub(:docs).and_return(mock_docs.slice(start, per_page))
17
+ allow(mock_response).to receive(:docs).and_return(mock_docs.slice(start, per_page))
18
18
  mock_response
19
19
  end
20
20
 
@@ -27,10 +27,10 @@ describe CatalogHelper do
27
27
  it "should be deprecated" do
28
28
  expect(Blacklight::CatalogHelperBehavior.deprecation_behavior.first).to receive(:call)
29
29
  assign(:response, double(:empty? => false))
30
- expect(helper.response_has_no_search_results?).to be_false
30
+ expect(helper.response_has_no_search_results?).to eq false
31
31
  end
32
32
  end
33
-
33
+
34
34
  describe "paginate_params" do
35
35
  let(:response) { double }
36
36
  it "should be deprecated" do
@@ -48,7 +48,7 @@ describe CatalogHelper do
48
48
  end
49
49
 
50
50
  end
51
-
51
+
52
52
  describe "page_entries_info" do
53
53
  before(:all) do
54
54
  end
@@ -57,16 +57,16 @@ describe CatalogHelper do
57
57
  @response = mock_response :total => 0
58
58
 
59
59
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
60
- html.should == "No entry_names found"
61
- html.html_safe?.should == true
60
+ expect(html).to eq("No entry_names found")
61
+ expect(html.html_safe?).to eq(true)
62
62
  end
63
63
 
64
64
  it "with no results (and no entry_name provided)" do
65
65
  @response = mock_response :total => 0
66
66
 
67
67
  html = page_entries_info(@response)
68
- html.should == "No entries found"
69
- html.html_safe?.should == true
68
+ expect(html).to eq("No entries found")
69
+ expect(html.html_safe?).to eq(true)
70
70
  end
71
71
 
72
72
  describe "with a single result" do
@@ -74,21 +74,21 @@ describe CatalogHelper do
74
74
  response = mock_response :total => 1
75
75
 
76
76
  html = page_entries_info(response, { :entry_name => 'entry_name' })
77
- html.should == "<strong>1</strong> entry_name found"
78
- html.html_safe?.should == true
77
+ expect(html).to eq("<strong>1</strong> entry_name found")
78
+ expect(html.html_safe?).to eq(true)
79
79
  end
80
80
 
81
81
  it "should infer a name" do
82
82
  response = mock_response :total => 1
83
83
 
84
84
  html = page_entries_info(response)
85
- html.should == "<strong>1</strong> entry found"
86
- html.html_safe?.should == true
85
+ expect(html).to eq("<strong>1</strong> entry found")
86
+ expect(html.html_safe?).to eq(true)
87
87
  end
88
88
 
89
89
  it "should use the model_name from the response" do
90
90
  response = mock_response :total => 1
91
- response.stub(:model_name).and_return(double(:human => 'thingy'))
91
+ allow(response).to receive(:model_name).and_return(double(:human => 'thingy'))
92
92
 
93
93
  html = page_entries_info(response)
94
94
  expect(html).to eq "<strong>1</strong> thingy found"
@@ -100,46 +100,46 @@ describe CatalogHelper do
100
100
  response = mock_response :total => 7
101
101
 
102
102
  html = page_entries_info(response, { :entry_name => 'entry_name' })
103
- html.should == "<strong>1</strong> - <strong>7</strong> of <strong>7</strong>"
104
- html.html_safe?.should == true
103
+ expect(html).to eq("<strong>1</strong> - <strong>7</strong> of <strong>7</strong>")
104
+ expect(html.html_safe?).to eq(true)
105
105
  end
106
106
 
107
107
  it "on the first page of multiple pages of results" do
108
108
  @response = mock_response :total => 15, :per_page => 10
109
109
 
110
110
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
111
- html.should == "<strong>1</strong> - <strong>10</strong> of <strong>15</strong>"
112
- html.html_safe?.should == true
111
+ expect(html).to eq("<strong>1</strong> - <strong>10</strong> of <strong>15</strong>")
112
+ expect(html.html_safe?).to eq(true)
113
113
  end
114
114
 
115
115
  it "on the second page of multiple pages of results" do
116
116
  @response = mock_response :total => 47, :per_page => 10, :current_page => 2
117
117
 
118
118
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
119
- html.should == "<strong>11</strong> - <strong>20</strong> of <strong>47</strong>"
120
- html.html_safe?.should == true
119
+ expect(html).to eq("<strong>11</strong> - <strong>20</strong> of <strong>47</strong>")
120
+ expect(html.html_safe?).to eq(true)
121
121
  end
122
122
 
123
123
  it "on the last page of results" do
124
124
  @response = mock_response :total => 47, :per_page => 10, :current_page => 5
125
125
 
126
126
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
127
- html.should == "<strong>41</strong> - <strong>47</strong> of <strong>47</strong>"
128
- html.html_safe?.should == true
127
+ expect(html).to eq("<strong>41</strong> - <strong>47</strong> of <strong>47</strong>")
128
+ expect(html.html_safe?).to eq(true)
129
129
  end
130
130
  it "should work with rows the same as per_page" do
131
131
  @response = mock_response :total => 47, :rows => 20, :current_page => 2
132
132
 
133
133
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
134
- html.should == "<strong>21</strong> - <strong>40</strong> of <strong>47</strong>"
135
- html.html_safe?.should == true
134
+ expect(html).to eq("<strong>21</strong> - <strong>40</strong> of <strong>47</strong>")
135
+ expect(html.html_safe?).to eq(true)
136
136
  end
137
137
 
138
138
  it "uses delimiters with large numbers" do
139
139
  @response = mock_response :total => 5000, :rows => 10, :current_page => 101
140
140
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
141
141
 
142
- html.should == "<strong>1,001</strong> - <strong>1,010</strong> of <strong>5,000</strong>"
142
+ expect(html).to eq("<strong>1,001</strong> - <strong>1,010</strong> of <strong>5,000</strong>")
143
143
  end
144
144
 
145
145
  it "should work with an activerecord collection" do
@@ -152,87 +152,87 @@ describe CatalogHelper do
152
152
 
153
153
  describe "should_autofocus_on_search_box?" do
154
154
  it "should be focused if we're on a catalog-like index page without query or facet parameters" do
155
- helper.stub(:controller => CatalogController.new, :action_name => "index", :params => { })
156
- expect(helper.should_autofocus_on_search_box?).to be_true
155
+ allow(helper).to receive_messages(:controller => CatalogController.new, :action_name => "index", :params => { })
156
+ expect(helper.should_autofocus_on_search_box?).to eq true
157
157
  end
158
158
 
159
159
  it "should not be focused if we're not on a catalog controller" do
160
- helper.stub(:controller => ApplicationController.new)
161
- expect(helper.should_autofocus_on_search_box?).to be_false
160
+ allow(helper).to receive_messages(:controller => ApplicationController.new)
161
+ expect(helper.should_autofocus_on_search_box?).to eq false
162
162
  end
163
163
 
164
164
  it "should not be focused if we're not on a catalog controller index" do
165
- helper.stub(:controller => CatalogController.new, :action_name => "show")
166
- expect(helper.should_autofocus_on_search_box?).to be_false
165
+ allow(helper).to receive_messages(:controller => CatalogController.new, :action_name => "show")
166
+ expect(helper.should_autofocus_on_search_box?).to eq false
167
167
  end
168
168
 
169
169
  it "should not be focused if a search string is provided" do
170
- helper.stub(:controller => CatalogController.new, :action_name => "index", :params => { :q => "hello"})
171
- expect(helper.should_autofocus_on_search_box?).to be_false
170
+ allow(helper).to receive_messages(:controller => CatalogController.new, :action_name => "index", :params => { :q => "hello"})
171
+ expect(helper.should_autofocus_on_search_box?).to eq false
172
172
  end
173
173
 
174
174
  it "should not be focused if a facet is selected" do
175
- helper.stub(:controller => CatalogController.new, :action_name => "index", :params => { :f => { "field" => ["value"]}})
176
- expect(helper.should_autofocus_on_search_box?).to be_false
175
+ allow(helper).to receive_messages(:controller => CatalogController.new, :action_name => "index", :params => { :f => { "field" => ["value"]}})
176
+ expect(helper.should_autofocus_on_search_box?).to eq false
177
177
  end
178
178
  end
179
179
 
180
180
  describe "has_thumbnail?" do
181
181
  it "should have a thumbnail if a thumbnail_method is configured" do
182
- helper.stub(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_method => :xyz) ))
182
+ allow(helper).to receive_messages(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_method => :xyz) ))
183
183
  document = double()
184
- expect(helper.has_thumbnail? document).to be_true
184
+ expect(helper.has_thumbnail? document).to be_truthy
185
185
  end
186
186
 
187
187
  it "should have a thumbnail if a thumbnail_field is configured and it exists in the document" do
188
- helper.stub(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_field => :xyz) ))
188
+ allow(helper).to receive_messages(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_field => :xyz) ))
189
189
  document = double(:has? => true)
190
- expect(helper.has_thumbnail? document).to be_true
190
+ expect(helper.has_thumbnail? document).to be_truthy
191
191
  end
192
-
192
+
193
193
  it "should not have a thumbnail if the thumbnail_field is missing from the document" do
194
- helper.stub(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_field => :xyz) ))
194
+ allow(helper).to receive_messages(:blacklight_config => OpenStruct.new(:index => OpenStruct.new(:thumbnail_field => :xyz) ))
195
195
  document = double(:has? => false)
196
- expect(helper.has_thumbnail? document).to be_false
196
+ expect(helper.has_thumbnail? document).to eq false
197
197
  end
198
198
 
199
199
  it "should not have a thumbnail if none of the fields are configured" do
200
- helper.stub(:blacklight_config => OpenStruct.new(:index => OpenStruct.new()))
201
- expect(helper.has_thumbnail? double()).to be_false
200
+ allow(helper).to receive_messages(:blacklight_config => OpenStruct.new(:index => OpenStruct.new()))
201
+ expect(helper.has_thumbnail? double()).to be_falsey
202
202
  end
203
203
  end
204
204
 
205
205
  describe "render_thumbnail_tag" do
206
206
  it "should call the provided thumbnail method" do
207
- helper.stub(:blacklight_config => double(:index => double(:thumbnail_method => :xyz)))
207
+ allow(helper).to receive_messages(:blacklight_config => double(:index => double(:thumbnail_method => :xyz)))
208
208
  document = double()
209
- helper.stub(:xyz => "some-thumbnail")
209
+ allow(helper).to receive_messages(:xyz => "some-thumbnail")
210
210
 
211
- helper.should_receive(:link_to_document).with(document, :label => "some-thumbnail")
211
+ expect(helper).to receive(:link_to_document).with(document, :label => "some-thumbnail")
212
212
  helper.render_thumbnail_tag document
213
213
  end
214
214
 
215
215
  it "should create an image tag from the given field" do
216
- helper.stub(:blacklight_config => double(:index => OpenStruct.new(:thumbnail_field => :xyz)))
216
+ allow(helper).to receive_messages(:blacklight_config => double(:index => OpenStruct.new(:thumbnail_field => :xyz)))
217
217
  document = double()
218
218
 
219
- document.stub(:has?).with(:xyz).and_return(true)
220
- document.stub(:first).with(:xyz).and_return("http://example.com/some.jpg")
219
+ allow(document).to receive(:has?).with(:xyz).and_return(true)
220
+ allow(document).to receive(:first).with(:xyz).and_return("http://example.com/some.jpg")
221
221
 
222
- helper.should_receive(:link_to_document).with(document, :label => image_tag("http://example.com/some.jpg"))
222
+ expect(helper).to receive(:link_to_document).with(document, :label => image_tag("http://example.com/some.jpg"))
223
223
  helper.render_thumbnail_tag document
224
224
  end
225
225
 
226
226
  it "should return nil if no thumbnail is available" do
227
- helper.stub(:blacklight_config => double(:index => OpenStruct.new()))
227
+ allow(helper).to receive_messages(:blacklight_config => double(:index => OpenStruct.new()))
228
228
 
229
229
  document = double()
230
230
  expect(helper.render_thumbnail_tag document).to be_nil
231
231
  end
232
232
 
233
233
  it "should return nil if no thumbnail is returned from the thumbnail method" do
234
- helper.stub(:blacklight_config => double(:index => OpenStruct.new(:thumbnail_method => :xyz)))
235
- helper.stub(:xyz => nil)
234
+ allow(helper).to receive_messages(:blacklight_config => double(:index => OpenStruct.new(:thumbnail_method => :xyz)))
235
+ allow(helper).to receive_messages(:xyz => nil)
236
236
  document = double()
237
237
 
238
238
  expect(helper.render_thumbnail_tag document).to be_nil
@@ -241,17 +241,17 @@ describe CatalogHelper do
241
241
 
242
242
  describe "thumbnail_url" do
243
243
  it "should pull the configured thumbnail field out of the document" do
244
- helper.stub(:blacklight_config => double(:index => double(:thumbnail_field => "xyz")))
244
+ allow(helper).to receive_messages(:blacklight_config => double(:index => double(:thumbnail_field => "xyz")))
245
245
  document = double()
246
- document.stub(:has?).with("xyz").and_return(true)
247
- document.stub(:first).with("xyz").and_return("asdf")
246
+ allow(document).to receive(:has?).with("xyz").and_return(true)
247
+ allow(document).to receive(:first).with("xyz").and_return("asdf")
248
248
  expect(helper.thumbnail_url document).to eq("asdf")
249
249
  end
250
250
 
251
251
  it "should return nil if the thumbnail field doesn't exist" do
252
- helper.stub(:blacklight_config => double(:index => double(:thumbnail_field => "xyz")))
252
+ allow(helper).to receive_messages(:blacklight_config => double(:index => double(:thumbnail_field => "xyz")))
253
253
  document = double()
254
- document.stub(:has?).with("xyz").and_return(false)
254
+ allow(document).to receive(:has?).with("xyz").and_return(false)
255
255
  expect(helper.thumbnail_url document).to be_nil
256
256
  end
257
257
  end
@@ -7,9 +7,9 @@ describe FacetsHelper do
7
7
  let(:blacklight_config) { Blacklight::Configuration.new }
8
8
 
9
9
  before(:each) do
10
- helper.stub(:blacklight_config).and_return blacklight_config
10
+ allow(helper).to receive(:blacklight_config).and_return blacklight_config
11
11
  end
12
-
12
+
13
13
  describe "has_facet_values?" do
14
14
  it "should be true if there are any facets to display" do
15
15
 
@@ -18,7 +18,7 @@ describe FacetsHelper do
18
18
  empty = double(:items => [])
19
19
 
20
20
  fields = [a,b,empty]
21
- helper.has_facet_values?(fields).should be_true
21
+ expect(helper.has_facet_values?(fields)).to be_truthy
22
22
  end
23
23
 
24
24
  it "should be false if all facets are empty" do
@@ -26,7 +26,7 @@ describe FacetsHelper do
26
26
  empty = double(:items => [])
27
27
 
28
28
  fields = [empty]
29
- helper.has_facet_values?(fields).should_not be_true
29
+ expect(helper.has_facet_values?(fields)).not_to be_truthy
30
30
  end
31
31
  end
32
32
 
@@ -41,42 +41,42 @@ describe FacetsHelper do
41
41
  config.add_facet_field 'lambda_no_show', :show => lambda { |context, config, field| false }
42
42
  end
43
43
 
44
- helper.stub(:blacklight_config => @config)
44
+ allow(helper).to receive_messages(:blacklight_config => @config)
45
45
  end
46
46
 
47
47
  it "should render facets with items" do
48
48
  a = double(:items => [1,2], :name=>'basic_field')
49
- helper.should_render_facet?(a).should == true
49
+ expect(helper.should_render_facet?(a)).to eq(true)
50
50
  end
51
51
  it "should not render facets without items" do
52
52
  empty = double(:items => [], :name=>'basic_field')
53
- helper.should_render_facet?(empty).should == false
53
+ expect(helper.should_render_facet?(empty)).to eq(false)
54
54
  end
55
55
 
56
56
  it "should not render facets where show is set to false" do
57
57
  a = double(:items => [1,2], :name=>'no_show')
58
- helper.should_render_facet?(a).should == false
58
+ expect(helper.should_render_facet?(a)).to eq(false)
59
59
  end
60
60
 
61
61
  it "should call a helper to determine if it should render a field" do
62
- helper.stub(:my_helper => true)
62
+ allow(helper).to receive_messages(:my_helper => true)
63
63
  a = double(:items => [1,2], :name=>'helper_show')
64
- expect(helper.should_render_facet?(a)).to be_true
64
+ expect(helper.should_render_facet?(a)).to eq true
65
65
  end
66
66
 
67
67
  it "should call a helper to determine if it should render a field" do
68
68
  a = double(:items => [1,2], :name=>'helper_with_an_arg_show')
69
- helper.should_receive(:my_helper_with_an_arg).with(a).and_return(true)
70
- expect(helper.should_render_facet?(a)).to be_true
69
+ expect(helper).to receive(:my_helper_with_an_arg).with(a).and_return(true)
70
+ expect(helper.should_render_facet?(a)).to eq true
71
71
  end
72
72
 
73
73
 
74
74
  it "should evaluate a Proc to determine if it should render a field" do
75
75
  a = double(:items => [1,2], :name=>'lambda_show')
76
- expect(helper.should_render_facet?(a)).to be_true
76
+ expect(helper.should_render_facet?(a)).to eq true
77
77
 
78
78
  a = double(:items => [1,2], :name=>'lambda_no_show')
79
- expect(helper.should_render_facet?(a)).to be_false
79
+ expect(helper.should_render_facet?(a)).to eq false
80
80
  end
81
81
  end
82
82
 
@@ -84,24 +84,24 @@ describe FacetsHelper do
84
84
  it "should retrieve the facet from the response given a string" do
85
85
  facet_config = double(:query => nil)
86
86
  facet_field = double()
87
- helper.should_receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
87
+ expect(helper).to receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
88
88
 
89
89
  @response = double()
90
- @response.should_receive(:facet_by_field_name).with('a').and_return(facet_field)
90
+ expect(@response).to receive(:facet_by_field_name).with('a').and_return(facet_field)
91
91
 
92
- helper.facet_by_field_name('a').should == facet_field
92
+ expect(helper.facet_by_field_name('a')).to eq(facet_field)
93
93
  end
94
94
 
95
95
  it "should also work for facet query fields" do
96
96
  facet_config = double(:query => {})
97
- helper.should_receive(:facet_configuration_for_field).with('a_query_facet_field').and_return(facet_config)
98
- helper.should_receive(:create_rsolr_facet_field_response_for_query_facet_field).with('a_query_facet_field', facet_config)
97
+ expect(helper).to receive(:facet_configuration_for_field).with('a_query_facet_field').and_return(facet_config)
98
+ expect(helper).to receive(:create_rsolr_facet_field_response_for_query_facet_field).with('a_query_facet_field', facet_config)
99
99
 
100
100
  helper.facet_by_field_name 'a_query_facet_field'
101
101
  end
102
102
 
103
103
  describe "query facets" do
104
- let(:facet_config) {
104
+ let(:facet_config) {
105
105
  double(
106
106
  :query => {
107
107
  'a_simple_query' => { :fq => 'field:search', :label => 'A Human Readable label'},
@@ -112,7 +112,7 @@ describe FacetsHelper do
112
112
  }
113
113
 
114
114
  before(:each) do
115
- helper.should_receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
115
+ expect(helper).to receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
116
116
 
117
117
  @response = double(:facet_queries => {
118
118
  'field:search' => 10,
@@ -124,17 +124,17 @@ describe FacetsHelper do
124
124
 
125
125
  it"should convert the query facets into a double RSolr FacetField" do
126
126
  field = helper.facet_by_field_name('my_query_facet_field')
127
- field.should be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
127
+ expect(field).to be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
128
128
 
129
- field.name.should == 'my_query_facet_field'
130
- field.items.length.should == 2
131
- field.items.map { |x| x.value }.should_not include 'field:not_appearing_in_the_config'
129
+ expect(field.name).to eq('my_query_facet_field')
130
+ expect(field.items.length).to eq(2)
131
+ expect(field.items.map { |x| x.value }).not_to include 'field:not_appearing_in_the_config'
132
132
 
133
133
  facet_item = field.items.select { |x| x.value == 'a_simple_query' }.first
134
134
 
135
- facet_item.value.should == 'a_simple_query'
136
- facet_item.hits.should == 10
137
- facet_item.label.should == 'A Human Readable label'
135
+ expect(facet_item.value).to eq('a_simple_query')
136
+ expect(facet_item.hits).to eq(10)
137
+ expect(facet_item.label).to eq('A Human Readable label')
138
138
  end
139
139
  end
140
140
 
@@ -143,24 +143,24 @@ describe FacetsHelper do
143
143
  double(:pivot => ['field_a', 'field_b'])
144
144
  }
145
145
 
146
- before(:each) do
147
- helper.should_receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
148
-
146
+ before(:each) do
147
+ expect(helper).to receive(:facet_configuration_for_field).with(anything()).and_return(facet_config)
148
+
149
149
  @response = double(:facet_pivot => { 'field_a,field_b' => [{:field => 'field_a', :value => 'a', :count => 10, :pivot => [{:field => 'field_b', :value => 'b', :count => 2}]}]})
150
150
  end
151
151
 
152
152
  it "should convert the pivot facet into a double RSolr FacetField" do
153
153
  field = helper.facet_by_field_name('my_pivot_facet_field')
154
- field.should be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
154
+ expect(field).to be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
155
155
 
156
- field.name.should == 'my_pivot_facet_field'
156
+ expect(field.name).to eq('my_pivot_facet_field')
157
157
 
158
- field.items.length.should == 1
158
+ expect(field.items.length).to eq(1)
159
159
 
160
- field.items.first.should respond_to(:items)
160
+ expect(field.items.first).to respond_to(:items)
161
161
 
162
- field.items.first.items.length.should == 1
163
- field.items.first.items.first.fq.should == { 'field_a' => 'a' }
162
+ expect(field.items.first.items.length).to eq(1)
163
+ expect(field.items.first.items.first.fq).to eq({ 'field_a' => 'a' })
164
164
  end
165
165
  end
166
166
  end
@@ -174,9 +174,9 @@ describe FacetsHelper do
174
174
 
175
175
  fields = [a,b,empty]
176
176
 
177
- helper.should_receive(:render_facet_limit).with(a, {})
178
- helper.should_receive(:render_facet_limit).with(b, {})
179
- helper.should_receive(:render_facet_limit).with(empty, {})
177
+ expect(helper).to receive(:render_facet_limit).with(a, {})
178
+ expect(helper).to receive(:render_facet_limit).with(b, {})
179
+ expect(helper).to receive(:render_facet_limit).with(empty, {})
180
180
 
181
181
  helper.render_facet_partials fields
182
182
  end
@@ -184,10 +184,10 @@ describe FacetsHelper do
184
184
  it "should default to the configured facets" do
185
185
  a = double(:items => [1,2])
186
186
  b = double(:items => ['b','c'])
187
- helper.should_receive(:facet_field_names) { [a,b] }
187
+ expect(helper).to receive(:facet_field_names) { [a,b] }
188
188
 
189
- helper.should_receive(:render_facet_limit).with(a, {})
190
- helper.should_receive(:render_facet_limit).with(b, {})
189
+ expect(helper).to receive(:render_facet_limit).with(a, {})
190
+ expect(helper).to receive(:render_facet_limit).with(b, {})
191
191
 
192
192
  helper.render_facet_partials
193
193
  end
@@ -204,15 +204,15 @@ describe FacetsHelper do
204
204
  config.add_facet_field 'my_facet_field_with_custom_partial', :partial => 'custom_facet_partial'
205
205
  end
206
206
 
207
- helper.stub(:blacklight_config => @config)
207
+ allow(helper).to receive_messages(:blacklight_config => @config)
208
208
  @response = double()
209
209
  end
210
210
 
211
211
  it "should set basic local variables" do
212
212
  @mock_facet = double(:name => 'basic_field', :items => [1,2,3])
213
- helper.should_receive(:render).with(hash_including(:partial => 'facet_limit',
214
- :locals => {
215
- :solr_field => 'basic_field',
213
+ expect(helper).to receive(:render).with(hash_including(:partial => 'facet_limit',
214
+ :locals => {
215
+ :solr_field => 'basic_field',
216
216
  :solr_fname => 'basic_field',
217
217
  :facet_field => helper.blacklight_config.facet_fields['basic_field'],
218
218
  :display_facet => @mock_facet }
@@ -222,39 +222,39 @@ describe FacetsHelper do
222
222
 
223
223
  it "should render a facet _not_ declared in the configuration" do
224
224
  @mock_facet = double(:name => 'asdf', :items => [1,2,3])
225
- helper.should_receive(:render).with(hash_including(:partial => 'facet_limit'))
225
+ expect(helper).to receive(:render).with(hash_including(:partial => 'facet_limit'))
226
226
  helper.render_facet_limit(@mock_facet)
227
227
  end
228
228
 
229
229
  it "should get the partial name from the configuration" do
230
230
  @mock_facet = double(:name => 'my_facet_field_with_custom_partial', :items => [1,2,3])
231
- helper.should_receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
231
+ expect(helper).to receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
232
232
  helper.render_facet_limit(@mock_facet)
233
- end
233
+ end
234
234
 
235
235
  it "should use a partial layout for rendering the facet frame" do
236
236
  @mock_facet = double(:name => 'my_facet_field_with_custom_partial', :items => [1,2,3])
237
- helper.should_receive(:render).with(hash_including(:layout => 'facet_layout'))
237
+ expect(helper).to receive(:render).with(hash_including(:layout => 'facet_layout'))
238
238
  helper.render_facet_limit(@mock_facet)
239
239
  end
240
240
 
241
241
  it "should allow the caller to opt-out of facet layouts" do
242
242
  @mock_facet = double(:name => 'my_facet_field_with_custom_partial', :items => [1,2,3])
243
- helper.should_receive(:render).with(hash_including(:layout => nil))
243
+ expect(helper).to receive(:render).with(hash_including(:layout => nil))
244
244
  helper.render_facet_limit(@mock_facet, :layout => nil)
245
245
  end
246
246
 
247
247
  it "should render the facet_pivot partial for pivot facets" do
248
248
  @mock_facet = double(:name => 'pivot_facet_field', :items => [1,2,3])
249
- helper.should_receive(:render).with(hash_including(:partial => 'facet_pivot'))
249
+ expect(helper).to receive(:render).with(hash_including(:partial => 'facet_pivot'))
250
250
  helper.render_facet_limit(@mock_facet)
251
- end
251
+ end
252
252
 
253
253
  it "should let you override the rendered partial for pivot facets" do
254
254
  @mock_facet = double(:name => 'my_pivot_facet_field_with_custom_partial', :items => [1,2,3])
255
- helper.should_receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
255
+ expect(helper).to receive(:render).with(hash_including(:partial => 'custom_facet_partial'))
256
256
  helper.render_facet_limit(@mock_facet)
257
- end
257
+ end
258
258
 
259
259
  it "should be deprecated when a string is passed" do
260
260
  expect(@response).to receive(:facet_by_field_name)
@@ -271,84 +271,84 @@ describe FacetsHelper do
271
271
  end
272
272
 
273
273
  it "should add facet value for no pre-existing facets" do
274
- helper.stub(:params).and_return(@params_no_existing_facet)
274
+ allow(helper).to receive(:params).and_return(@params_no_existing_facet)
275
275
 
276
276
  result_params = helper.add_facet_params("facet_field", "facet_value")
277
- result_params[:f].should be_a_kind_of(Hash)
278
- result_params[:f]["facet_field"].should be_a_kind_of(Array)
279
- result_params[:f]["facet_field"].should == ["facet_value"]
277
+ expect(result_params[:f]).to be_a_kind_of(Hash)
278
+ expect(result_params[:f]["facet_field"]).to be_a_kind_of(Array)
279
+ expect(result_params[:f]["facet_field"]).to eq(["facet_value"])
280
280
  end
281
281
 
282
282
  it "should add a facet param to existing facet constraints" do
283
- helper.stub(:params).and_return(@params_existing_facets)
284
-
283
+ allow(helper).to receive(:params).and_return(@params_existing_facets)
284
+
285
285
  result_params = helper.add_facet_params("facet_field_2", "new_facet_value")
286
286
 
287
- result_params[:f].should be_a_kind_of(Hash)
287
+ expect(result_params[:f]).to be_a_kind_of(Hash)
288
288
 
289
289
  @params_existing_facets[:f].each_pair do |facet_field, value_list|
290
- result_params[:f][facet_field].should be_a_kind_of(Array)
291
-
290
+ expect(result_params[:f][facet_field]).to be_a_kind_of(Array)
291
+
292
292
  if facet_field == 'facet_field_2'
293
- result_params[:f][facet_field].should == (@params_existing_facets[:f][facet_field] | ["new_facet_value"])
293
+ expect(result_params[:f][facet_field]).to eq(@params_existing_facets[:f][facet_field] | ["new_facet_value"])
294
294
  else
295
- result_params[:f][facet_field].should == @params_existing_facets[:f][facet_field]
296
- end
295
+ expect(result_params[:f][facet_field]).to eq(@params_existing_facets[:f][facet_field])
296
+ end
297
297
  end
298
298
  end
299
299
  it "should leave non-facet params alone" do
300
300
  [@params_existing_facets, @params_no_existing_facet].each do |params|
301
- helper.stub(:params).and_return(params)
301
+ allow(helper).to receive(:params).and_return(params)
302
302
 
303
303
  result_params = helper.add_facet_params("facet_field_2", "new_facet_value")
304
304
 
305
305
  params.each_pair do |key, value|
306
306
  next if key == :f
307
- result_params[key].should == params[key]
308
- end
307
+ expect(result_params[key]).to eq(params[key])
308
+ end
309
309
  end
310
- end
310
+ end
311
311
 
312
312
  it "should replace facets for facets configured as single" do
313
- helper.should_receive(:facet_configuration_for_field).with('single_value_facet_field').and_return(double(:single => true))
313
+ expect(helper).to receive(:facet_configuration_for_field).with('single_value_facet_field').and_return(double(:single => true))
314
314
  params = { :f => { 'single_value_facet_field' => 'other_value'}}
315
- helper.stub(:params).and_return params
315
+ allow(helper).to receive(:params).and_return params
316
316
 
317
317
  result_params = helper.add_facet_params('single_value_facet_field', 'my_value')
318
318
 
319
319
 
320
- result_params[:f]['single_value_facet_field'].length.should == 1
321
- result_params[:f]['single_value_facet_field'].first.should == 'my_value'
320
+ expect(result_params[:f]['single_value_facet_field'].length).to eq(1)
321
+ expect(result_params[:f]['single_value_facet_field'].first).to eq('my_value')
322
322
  end
323
323
 
324
324
  it "should accept a FacetItem instead of a plain facet value" do
325
-
325
+
326
326
  result_params = helper.add_facet_params('facet_field_1', double(:value => 123))
327
327
 
328
- result_params[:f]['facet_field_1'].should include(123)
328
+ expect(result_params[:f]['facet_field_1']).to include(123)
329
329
  end
330
330
 
331
331
  it "should defer to the field set on a FacetItem" do
332
-
332
+
333
333
  result_params = helper.add_facet_params('facet_field_1', double(:field => 'facet_field_2', :value => 123))
334
334
 
335
- result_params[:f]['facet_field_1'].should be_blank
336
- result_params[:f]['facet_field_2'].should include(123)
335
+ expect(result_params[:f]['facet_field_1']).to be_blank
336
+ expect(result_params[:f]['facet_field_2']).to include(123)
337
337
  end
338
338
 
339
339
  it "should add any extra fq parameters from the FacetItem" do
340
-
340
+
341
341
  result_params = helper.add_facet_params('facet_field_1', double(:value => 123, :fq => {'facet_field_2' => 'abc'}))
342
342
 
343
- result_params[:f]['facet_field_1'].should include(123)
344
- result_params[:f]['facet_field_2'].should include('abc')
343
+ expect(result_params[:f]['facet_field_1']).to include(123)
344
+ expect(result_params[:f]['facet_field_2']).to include('abc')
345
345
  end
346
346
  end
347
347
 
348
348
  describe "add_facet_params_and_redirect" do
349
349
  before do
350
- catalog_facet_params = {:q => "query",
351
- :search_field => "search_field",
350
+ catalog_facet_params = {:q => "query",
351
+ :search_field => "search_field",
352
352
  :per_page => "50",
353
353
  :page => "5",
354
354
  :f => {"facet_field_1" => ["value1"], "facet_field_2" => ["value2", "value2a"]},
@@ -356,25 +356,25 @@ describe FacetsHelper do
356
356
  Blacklight::Solr::FacetPaginator.request_keys[:sort] => "index",
357
357
  :id => 'facet_field_name'
358
358
  }
359
- helper.stub(:params).and_return(catalog_facet_params)
359
+ allow(helper).to receive(:params).and_return(catalog_facet_params)
360
360
  end
361
361
  it "should redirect to 'index' action" do
362
362
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
363
363
 
364
- params[:action].should == "index"
364
+ expect(params[:action]).to eq("index")
365
365
  end
366
366
  it "should not include request parameters used by the facet paginator" do
367
367
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
368
368
 
369
369
  bad_keys = Blacklight::Solr::FacetPaginator.request_keys.values + [:id]
370
370
  bad_keys.each do |paginator_key|
371
- params.keys.should_not include(paginator_key)
371
+ expect(params.keys).not_to include(paginator_key)
372
372
  end
373
373
  end
374
374
  it 'should remove :page request key' do
375
375
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
376
376
 
377
- params.keys.should_not include(:page)
377
+ expect(params.keys).not_to include(:page)
378
378
  end
379
379
  it "should otherwise do the same thing as add_facet_params" do
380
380
  added_facet_params = helper.add_facet_params("facet_field_2", "facet_value")
@@ -382,8 +382,8 @@ describe FacetsHelper do
382
382
 
383
383
  added_facet_params_from_facet_action.each_pair do |key, value|
384
384
  next if key == :action
385
- value.should == added_facet_params[key]
386
- end
385
+ expect(value).to eq(added_facet_params[key])
386
+ end
387
387
  end
388
388
  end
389
389
 
@@ -393,9 +393,9 @@ describe FacetsHelper do
393
393
 
394
394
  describe "facet_field_in_params?" do
395
395
  it "should check if the facet field is selected in the user params" do
396
- helper.stub(:params => { :f => { "some-field" => ["x"]}})
397
- expect(helper.facet_field_in_params?("some-field")).to be_true
398
- expect(helper.facet_field_in_params?("other-field")).to_not be_true
396
+ allow(helper).to receive_messages(:params => { :f => { "some-field" => ["x"]}})
397
+ expect(helper.facet_field_in_params?("some-field")).to be_truthy
398
+ expect(helper.facet_field_in_params?("other-field")).to_not be_truthy
399
399
  end
400
400
  end
401
401
 
@@ -405,53 +405,53 @@ describe FacetsHelper do
405
405
 
406
406
  describe "render_facet_value" do
407
407
  it "should use facet_display_value" do
408
- helper.stub(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :single => false))
409
-
410
- helper.should_receive(:facet_display_value).and_return('Z')
411
- helper.should_receive(:add_facet_params_and_redirect).and_return('link')
408
+ allow(helper).to receive(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :single => false))
409
+
410
+ expect(helper).to receive(:facet_display_value).and_return('Z')
411
+ expect(helper).to receive(:add_facet_params_and_redirect).and_return('link')
412
412
  expected = Nokogiri::HTML "<a class=\"facet_select\" href=\"link\">Z</a> <span class=\"count\">10</span>"
413
413
  rendered = Nokogiri::HTML helper.render_facet_value('simple_field', double(:value => 'A', :hits => 10))
414
414
 
415
- rendered.should be_equivalent_to(expected).respecting_element_order
415
+ expect(rendered).to be_equivalent_to(expected).respecting_element_order
416
416
  end
417
417
 
418
418
 
419
419
  it "should suppress the link" do
420
- helper.stub(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :single => false))
421
-
422
- helper.should_receive(:facet_display_value).and_return('Z')
423
- helper.should_receive(:add_facet_params_and_redirect).and_return('link')
424
- helper.render_facet_value('simple_field', double(:value => 'A', :hits => 10), :suppress_link => true).should == "Z <span class=\"count\">10</span>"
420
+ allow(helper).to receive(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil, :single => false))
421
+
422
+ expect(helper).to receive(:facet_display_value).and_return('Z')
423
+ expect(helper).to receive(:add_facet_params_and_redirect).and_return('link')
424
+ expect(helper.render_facet_value('simple_field', double(:value => 'A', :hits => 10), :suppress_link => true)).to eq("Z <span class=\"count\">10</span>")
425
425
  end
426
426
  end
427
-
427
+
428
428
  describe "#facet_display_value" do
429
429
  it "should just be the facet value for an ordinary facet" do
430
- helper.stub(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil))
431
- helper.facet_display_value('simple_field', 'asdf').should == 'asdf'
430
+ allow(helper).to receive(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil))
431
+ expect(helper.facet_display_value('simple_field', 'asdf')).to eq('asdf')
432
432
  end
433
433
 
434
434
  it "should allow you to pass in a :helper_method argument to the configuration" do
435
- helper.stub(:facet_configuration_for_field).with('helper_field').and_return(double(:query => nil, :date => nil, :helper_method => :my_facet_value_renderer))
436
-
437
- helper.should_receive(:my_facet_value_renderer).with('qwerty').and_return('abc')
435
+ allow(helper).to receive(:facet_configuration_for_field).with('helper_field').and_return(double(:query => nil, :date => nil, :helper_method => :my_facet_value_renderer))
436
+
437
+ expect(helper).to receive(:my_facet_value_renderer).with('qwerty').and_return('abc')
438
438
 
439
- helper.facet_display_value('helper_field', 'qwerty').should == 'abc'
439
+ expect(helper.facet_display_value('helper_field', 'qwerty')).to eq('abc')
440
440
  end
441
441
 
442
442
  it "should extract the configuration label for a query facet" do
443
- helper.stub(:facet_configuration_for_field).with('query_facet').and_return(double(:query => { 'query_key' => { :label => 'XYZ'}}, :date => nil, :helper_method => nil))
444
- helper.facet_display_value('query_facet', 'query_key').should == 'XYZ'
443
+ allow(helper).to receive(:facet_configuration_for_field).with('query_facet').and_return(double(:query => { 'query_key' => { :label => 'XYZ'}}, :date => nil, :helper_method => nil))
444
+ expect(helper.facet_display_value('query_facet', 'query_key')).to eq('XYZ')
445
445
  end
446
446
 
447
447
  it "should localize the label for date-type facets" do
448
- helper.stub(:facet_configuration_for_field).with('date_facet').and_return(double('date' => true, :query => nil, :helper_method => nil))
449
- helper.facet_display_value('date_facet', '2012-01-01').should == 'Sun, 01 Jan 2012 00:00:00 +0000'
448
+ allow(helper).to receive(:facet_configuration_for_field).with('date_facet').and_return(double('date' => true, :query => nil, :helper_method => nil))
449
+ expect(helper.facet_display_value('date_facet', '2012-01-01')).to eq('Sun, 01 Jan 2012 00:00:00 +0000')
450
450
  end
451
451
 
452
452
  it "should localize the label for date-type facets with the supplied localization options" do
453
- helper.stub(:facet_configuration_for_field).with('date_facet').and_return(double('date' => { :format => :short }, :query => nil, :helper_method => nil))
454
- helper.facet_display_value('date_facet', '2012-01-01').should == '01 Jan 00:00'
453
+ allow(helper).to receive(:facet_configuration_for_field).with('date_facet').and_return(double('date' => { :format => :short }, :query => nil, :helper_method => nil))
454
+ expect(helper.facet_display_value('date_facet', '2012-01-01')).to eq('01 Jan 00:00')
455
455
  end
456
456
  end
457
457
  end