blacklight 5.0.0.pre1 → 5.0.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -4
  3. data/VERSION +1 -1
  4. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +4 -0
  5. data/app/assets/stylesheets/blacklight/_catalog.css.scss +9 -13
  6. data/app/helpers/blacklight/blacklight_helper_behavior.rb +15 -9
  7. data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -25
  8. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
  9. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -1
  10. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
  11. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -1
  12. data/app/views/bookmarks/index.html.erb +1 -1
  13. data/app/views/catalog/_did_you_mean.html.erb +1 -1
  14. data/app/views/catalog/_document.html.erb +4 -10
  15. data/app/views/catalog/{_document_header.html.erb → _index_header_default.html.erb} +6 -3
  16. data/app/views/catalog/_paginate_compact.html.erb +5 -0
  17. data/app/views/catalog/_show_header_default.html.erb +2 -0
  18. data/app/views/catalog/index.html.erb +1 -1
  19. data/app/views/catalog/show.html.erb +4 -10
  20. data/lib/blacklight.rb +0 -1
  21. data/lib/blacklight/configuration.rb +2 -2
  22. data/lib/blacklight/controller.rb +0 -1
  23. data/lib/blacklight/solr/document.rb +2 -0
  24. data/lib/blacklight/solr/document/schema_org.rb +7 -0
  25. data/lib/blacklight/solr_response.rb +4 -0
  26. data/lib/blacklight/user.rb +0 -6
  27. data/spec/controllers/application_controller_spec.rb +1 -2
  28. data/spec/controllers/bookmarks_controller_spec.rb +8 -9
  29. data/spec/controllers/catalog_controller_spec.rb +72 -73
  30. data/spec/controllers/saved_searches_controller_spec.rb +1 -2
  31. data/spec/controllers/search_history_controller_spec.rb +9 -10
  32. data/spec/features/search_pagination_spec.rb +1 -0
  33. data/spec/features/search_results_spec.rb +1 -0
  34. data/spec/features/search_spec.rb +1 -0
  35. data/spec/helpers/blacklight_helper_spec.rb +103 -93
  36. data/spec/helpers/catalog_helper_spec.rb +34 -21
  37. data/spec/helpers/facets_helper_spec.rb +41 -41
  38. data/spec/helpers/hash_as_hidden_fields_spec.rb +8 -9
  39. data/spec/helpers/render_constraints_helper_spec.rb +3 -3
  40. data/spec/helpers/search_history_constraints_helper_spec.rb +13 -14
  41. data/spec/lib/{blacklight_configurable_spec.rb → blacklight/configurable_spec.rb} +12 -14
  42. data/spec/lib/{blacklight_configuration_spec.rb → blacklight/configuration_spec.rb} +67 -69
  43. data/spec/lib/{facet_paginator_spec.rb → blacklight/facet_paginator_spec.rb} +13 -16
  44. data/spec/lib/{search_fields_spec.rb → blacklight/search_fields_spec.rb} +14 -15
  45. data/spec/lib/{blacklight_solr_document_dublin_core_spec.rb → blacklight/solr/document/dublin_core_spec.rb} +7 -8
  46. data/spec/lib/{blacklight_email_spec.rb → blacklight/solr/document/email_spec.rb} +5 -6
  47. data/spec/lib/{blacklight_solr_document_more_like_this_spec.rb → blacklight/solr/document/more_like_this_spec.rb} +5 -5
  48. data/spec/lib/{blacklight_sms_spec.rb → blacklight/solr/document/sms_spec.rb} +5 -6
  49. data/spec/lib/{blacklight_solr_document_spec.rb → blacklight/solr/document_spec.rb} +37 -39
  50. data/spec/lib/{solr_helper_spec.rb → blacklight/solr_helper_spec.rb} +183 -183
  51. data/spec/lib/{blacklight_solr_response_spec.rb → blacklight/solr_response_spec.rb} +20 -16
  52. data/spec/lib/{blacklight_user_spec.rb → blacklight/user_spec.rb} +3 -4
  53. data/spec/lib/blacklight_spec.rb +6 -7
  54. data/spec/lib/tasks/blacklight_task_spec.rb +2 -3
  55. data/spec/lib/utils_spec.rb +13 -14
  56. data/spec/models/bookmark_spec.rb +4 -4
  57. data/spec/models/record_mailer_spec.rb +15 -15
  58. data/spec/models/search_spec.rb +7 -7
  59. data/spec/models/solr_document_spec.rb +4 -4
  60. data/spec/routing/catalog_routing_spec.rb +12 -12
  61. data/spec/spec_helper.rb +1 -3
  62. data/spec/test_app_templates/Gemfile.extra +1 -2
  63. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +12 -13
  64. data/spec/views/catalog/_document.html.erb_spec.rb +19 -2
  65. data/spec/views/catalog/_document_list.html.erb_spec.rb +0 -1
  66. data/spec/views/catalog/_facets.html.erb_spec.rb +5 -5
  67. data/spec/views/catalog/_index_default.erb_spec.rb +10 -11
  68. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +45 -0
  69. data/spec/views/catalog/_search_header.erb_spec.rb +0 -1
  70. data/spec/views/catalog/_show_default.erb_spec.rb +10 -11
  71. data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -3
  72. data/spec/views/catalog/index.atom.builder_spec.rb +26 -27
  73. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  74. data/spec/views/catalog/show.html.erb_spec.rb +56 -0
  75. data/tasks/blacklight.rake +1 -1
  76. metadata +65 -64
  77. data/lib/blacklight/legacy_controller_methods.rb +0 -26
  78. data/spec/rcov.opts +0 -3
  79. data/spec/support/assert_difference.rb +0 -17
@@ -1,5 +1,5 @@
1
- # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
+
3
3
  describe CatalogHelper do
4
4
  include ERB::Util
5
5
  include CatalogHelper
@@ -31,16 +31,16 @@ describe CatalogHelper do
31
31
  @response = mock_response :total => 0
32
32
 
33
33
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
34
- html.should == "No entry_names found"
35
- html.html_safe?.should == true
34
+ expect(html).to eq "No entry_names found"
35
+ expect(html).to be_html_safe
36
36
  end
37
37
 
38
38
  it "with no results (and no entry_name provided)" do
39
39
  @response = mock_response :total => 0
40
40
 
41
41
  html = page_entries_info(@response)
42
- html.should == "No entries found"
43
- html.html_safe?.should == true
42
+ expect(html).to eq "No entries found"
43
+ expect(html).to be_html_safe
44
44
  end
45
45
 
46
46
  describe "with a single result" do
@@ -48,21 +48,21 @@ describe CatalogHelper do
48
48
  response = mock_response :total => 1
49
49
 
50
50
  html = page_entries_info(response, { :entry_name => 'entry_name' })
51
- html.should == "<strong>1</strong> entry_name found"
52
- html.html_safe?.should == true
51
+ expect(html).to eq "<strong>1</strong> entry_name found"
52
+ expect(html).to be_html_safe
53
53
  end
54
54
 
55
55
  it "should infer a name" do
56
56
  response = mock_response :total => 1
57
57
 
58
58
  html = page_entries_info(response)
59
- html.should == "<strong>1</strong> entry found"
60
- html.html_safe?.should == true
59
+ expect(html).to eq "<strong>1</strong> entry found"
60
+ expect(html).to be_html_safe
61
61
  end
62
62
 
63
63
  it "should use the model_name from the response" do
64
64
  response = mock_response :total => 1
65
- response.stub(:model_name).and_return('thingy')
65
+ response.stub(:model_name).and_return(double(:human => 'thingy'))
66
66
 
67
67
  html = page_entries_info(response)
68
68
  expect(html).to eq "<strong>1</strong> thingy found"
@@ -74,39 +74,52 @@ describe CatalogHelper do
74
74
  response = mock_response :total => 7
75
75
 
76
76
  html = page_entries_info(response, { :entry_name => 'entry_name' })
77
- html.should == "<strong>1</strong> - <strong>7</strong> of <strong>7</strong>"
78
- html.html_safe?.should == true
77
+ expect(html).to eq "<strong>1</strong> - <strong>7</strong> of <strong>7</strong>"
78
+ expect(html).to be_html_safe
79
79
  end
80
80
 
81
81
  it "on the first page of multiple pages of results" do
82
82
  @response = mock_response :total => 15, :per_page => 10
83
83
 
84
84
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
85
- html.should == "<strong>1</strong> - <strong>10</strong> of <strong>15</strong>"
86
- html.html_safe?.should == true
85
+ expect(html).to eq "<strong>1</strong> - <strong>10</strong> of <strong>15</strong>"
86
+ expect(html).to be_html_safe
87
87
  end
88
88
 
89
89
  it "on the second page of multiple pages of results" do
90
90
  @response = mock_response :total => 47, :per_page => 10, :current_page => 2
91
91
 
92
92
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
93
- html.should == "<strong>11</strong> - <strong>20</strong> of <strong>47</strong>"
94
- html.html_safe?.should == true
93
+ expect(html).to eq "<strong>11</strong> - <strong>20</strong> of <strong>47</strong>"
94
+ expect(html).to be_html_safe
95
95
  end
96
96
 
97
97
  it "on the last page of results" do
98
98
  @response = mock_response :total => 47, :per_page => 10, :current_page => 5
99
99
 
100
100
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
101
- html.should == "<strong>41</strong> - <strong>47</strong> of <strong>47</strong>"
102
- html.html_safe?.should == true
101
+ expect(html).to eq "<strong>41</strong> - <strong>47</strong> of <strong>47</strong>"
102
+ expect(html).to be_html_safe
103
103
  end
104
104
  it "should work with rows the same as per_page" do
105
105
  @response = mock_response :total => 47, :rows => 20, :current_page => 2
106
106
 
107
107
  html = page_entries_info(@response, { :entry_name => 'entry_name' })
108
- html.should == "<strong>21</strong> - <strong>40</strong> of <strong>47</strong>"
109
- html.html_safe?.should == true
108
+ expect(html).to eq "<strong>21</strong> - <strong>40</strong> of <strong>47</strong>"
109
+ expect(html).to be_html_safe
110
+ end
111
+
112
+ it "uses delimiters with large numbers" do
113
+ @response = mock_response :total => 5000, :rows => 10, :current_page => 101
114
+ html = page_entries_info(@response, { :entry_name => 'entry_name' })
115
+
116
+ expect(html).to eq "<strong>1,001</strong> - <strong>1,010</strong> of <strong>5,000</strong>"
117
+ end
118
+
119
+ it "should work with an activerecord collection" do
120
+ 50.times { b = Bookmark.new; b.user_id = 1; b.save! }
121
+ html = helper.page_entries_info(Bookmark.page(1).per(25))
122
+ expect(html).to eq "<strong>1</strong> - <strong>25</strong> of <strong>50</strong>"
110
123
  end
111
124
 
112
125
  end
@@ -17,7 +17,7 @@ describe FacetsHelper do
17
17
  empty = double(:items => [])
18
18
 
19
19
  fields = [a,b,empty]
20
- helper.has_facet_values?(fields).should be_true
20
+ expect(helper.has_facet_values?(fields)).to be_true
21
21
  end
22
22
 
23
23
  it "should be false if all facets are empty" do
@@ -25,7 +25,7 @@ describe FacetsHelper do
25
25
  empty = double(:items => [])
26
26
 
27
27
  fields = [empty]
28
- helper.has_facet_values?(fields).should_not be_true
28
+ expect(helper.has_facet_values?(fields)).to be_false
29
29
  end
30
30
  end
31
31
 
@@ -40,16 +40,16 @@ describe FacetsHelper do
40
40
  end
41
41
  it "should render facets with items" do
42
42
  a = double(:items => [1,2], :name=>'basic_field')
43
- helper.should_render_facet?(a).should == true
43
+ expect(helper.should_render_facet?(a)).to be_true
44
44
  end
45
45
  it "should not render facets without items" do
46
46
  empty = double(:items => [], :name=>'basic_field')
47
- helper.should_render_facet?(empty).should == false
47
+ expect(helper.should_render_facet?(empty)).to be_false
48
48
  end
49
49
 
50
50
  it "should not render facets where show is set to false" do
51
51
  a = double(:items => [1,2], :name=>'no_show')
52
- helper.should_render_facet?(a).should == false
52
+ expect(helper.should_render_facet?(a)).to be_false
53
53
  end
54
54
  end
55
55
 
@@ -62,7 +62,7 @@ describe FacetsHelper do
62
62
  @response = double()
63
63
  @response.should_receive(:facet_by_field_name).with('a').and_return(facet_field)
64
64
 
65
- helper.facet_by_field_name('a').should == facet_field
65
+ expect(helper.facet_by_field_name('a')).to eq facet_field
66
66
  end
67
67
 
68
68
  it "should also work for facet query fields" do
@@ -99,15 +99,15 @@ describe FacetsHelper do
99
99
  field = helper.facet_by_field_name('my_query_facet_field')
100
100
  field.should be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
101
101
 
102
- field.name.should == 'my_query_facet_field'
103
- field.items.length.should == 2
104
- field.items.map { |x| x.value }.should_not include 'field:not_appearing_in_the_config'
102
+ expect(field.name).to eq'my_query_facet_field'
103
+ expect(field.items).to have(2).items
104
+ expect(field.items.map { |x| x.value }).to_not include 'field:not_appearing_in_the_config'
105
105
 
106
106
  facet_item = field.items.select { |x| x.value == 'a_simple_query' }.first
107
107
 
108
- facet_item.value.should == 'a_simple_query'
109
- facet_item.hits.should == 10
110
- facet_item.label.should == 'A Human Readable label'
108
+ expect(facet_item.value).to eq 'a_simple_query'
109
+ expect(facet_item.hits).to eq 10
110
+ expect(facet_item.label).to eq 'A Human Readable label'
111
111
  end
112
112
  end
113
113
 
@@ -126,14 +126,14 @@ describe FacetsHelper do
126
126
  field = helper.facet_by_field_name('my_pivot_facet_field')
127
127
  field.should be_a_kind_of Blacklight::SolrResponse::Facets::FacetField
128
128
 
129
- field.name.should == 'my_pivot_facet_field'
129
+ expect(field.name).to eq 'my_pivot_facet_field'
130
130
 
131
- field.items.length.should == 1
131
+ expect(field.items).to have(1).item
132
132
 
133
- field.items.first.should respond_to(:items)
133
+ expect(field.items.first).to respond_to(:items)
134
134
 
135
- field.items.first.items.length.should == 1
136
- field.items.first.items.first.fq.should == { 'field_a' => 'a' }
135
+ expect(field.items.first.items).to have(1).item
136
+ expect(field.items.first.items.first.fq).to eq({ 'field_a' => 'a' })
137
137
  end
138
138
  end
139
139
  end
@@ -239,9 +239,9 @@ describe FacetsHelper do
239
239
  helper.stub(:params).and_return(@params_no_existing_facet)
240
240
 
241
241
  result_params = helper.add_facet_params("facet_field", "facet_value")
242
- result_params[:f].should be_a_kind_of(Hash)
243
- result_params[:f]["facet_field"].should be_a_kind_of(Array)
244
- result_params[:f]["facet_field"].should == ["facet_value"]
242
+ expect(result_params[:f]).to be_a_kind_of(Hash)
243
+ expect(result_params[:f]["facet_field"]).to be_a_kind_of(Array)
244
+ expect(result_params[:f]["facet_field"]).to eq ["facet_value"]
245
245
  end
246
246
 
247
247
  it "should add a facet param to existing facet constraints" do
@@ -249,15 +249,15 @@ describe FacetsHelper do
249
249
 
250
250
  result_params = helper.add_facet_params("facet_field_2", "new_facet_value")
251
251
 
252
- result_params[:f].should be_a_kind_of(Hash)
252
+ expect(result_params[:f]).to be_a_kind_of(Hash)
253
253
 
254
254
  @params_existing_facets[:f].each_pair do |facet_field, value_list|
255
- result_params[:f][facet_field].should be_a_kind_of(Array)
255
+ expect(result_params[:f][facet_field]).to be_a_kind_of(Array)
256
256
 
257
257
  if facet_field == 'facet_field_2'
258
- result_params[:f][facet_field].should == (@params_existing_facets[:f][facet_field] | ["new_facet_value"])
258
+ expect(result_params[:f][facet_field]).to eq (@params_existing_facets[:f][facet_field] | ["new_facet_value"])
259
259
  else
260
- result_params[:f][facet_field].should == @params_existing_facets[:f][facet_field]
260
+ expect(result_params[:f][facet_field]).to eq @params_existing_facets[:f][facet_field]
261
261
  end
262
262
  end
263
263
  end
@@ -269,7 +269,7 @@ describe FacetsHelper do
269
269
 
270
270
  params.each_pair do |key, value|
271
271
  next if key == :f
272
- result_params[key].should == params[key]
272
+ expect(result_params[key]).to eq params[key]
273
273
  end
274
274
  end
275
275
  end
@@ -282,31 +282,31 @@ describe FacetsHelper do
282
282
  result_params = helper.add_facet_params('single_value_facet_field', 'my_value')
283
283
 
284
284
 
285
- result_params[:f]['single_value_facet_field'].length.should == 1
286
- result_params[:f]['single_value_facet_field'].first.should == 'my_value'
285
+ expect(result_params[:f]['single_value_facet_field']).to have(1).item
286
+ expect(result_params[:f]['single_value_facet_field'].first).to eq 'my_value'
287
287
  end
288
288
 
289
289
  it "should accept a FacetItem instead of a plain facet value" do
290
290
 
291
291
  result_params = helper.add_facet_params('facet_field_1', double(:value => 123))
292
292
 
293
- result_params[:f]['facet_field_1'].should include(123)
293
+ expect(result_params[:f]['facet_field_1']).to include(123)
294
294
  end
295
295
 
296
296
  it "should defer to the field set on a FacetItem" do
297
297
 
298
298
  result_params = helper.add_facet_params('facet_field_1', double(:field => 'facet_field_2', :value => 123))
299
299
 
300
- result_params[:f]['facet_field_1'].should be_blank
301
- result_params[:f]['facet_field_2'].should include(123)
300
+ expect(result_params[:f]['facet_field_1']).to be_blank
301
+ expect(result_params[:f]['facet_field_2']).to include(123)
302
302
  end
303
303
 
304
304
  it "should add any extra fq parameters from the FacetItem" do
305
305
 
306
306
  result_params = helper.add_facet_params('facet_field_1', double(:value => 123, :fq => {'facet_field_2' => 'abc'}))
307
307
 
308
- result_params[:f]['facet_field_1'].should include(123)
309
- result_params[:f]['facet_field_2'].should include('abc')
308
+ expect(result_params[:f]['facet_field_1']).to include(123)
309
+ expect(result_params[:f]['facet_field_2']).to include('abc')
310
310
  end
311
311
  end
312
312
 
@@ -326,20 +326,20 @@ describe FacetsHelper do
326
326
  it "should redirect to 'index' action" do
327
327
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
328
328
 
329
- params[:action].should == "index"
329
+ expect(params[:action]).to eq "index"
330
330
  end
331
331
  it "should not include request parameters used by the facet paginator" do
332
332
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
333
333
 
334
334
  bad_keys = Blacklight::Solr::FacetPaginator.request_keys.values + [:id]
335
335
  bad_keys.each do |paginator_key|
336
- params.keys.should_not include(paginator_key)
336
+ expect(params.keys).to_not include(paginator_key)
337
337
  end
338
338
  end
339
339
  it 'should remove :page request key' do
340
340
  params = helper.add_facet_params_and_redirect("facet_field_2", "facet_value")
341
341
 
342
- params.keys.should_not include(:page)
342
+ expect(params.keys).to_not include(:page)
343
343
  end
344
344
  it "should otherwise do the same thing as add_facet_params" do
345
345
  added_facet_params = helper.add_facet_params("facet_field_2", "facet_value")
@@ -347,7 +347,7 @@ describe FacetsHelper do
347
347
 
348
348
  added_facet_params_from_facet_action.each_pair do |key, value|
349
349
  next if key == :action
350
- value.should == added_facet_params[key]
350
+ expect(value).to eq added_facet_params[key]
351
351
  end
352
352
  end
353
353
  end
@@ -406,7 +406,7 @@ describe FacetsHelper do
406
406
  describe "#facet_display_value" do
407
407
  it "should just be the facet value for an ordinary facet" do
408
408
  helper.stub(:facet_configuration_for_field).with('simple_field').and_return(double(:query => nil, :date => nil, :helper_method => nil))
409
- helper.facet_display_value('simple_field', 'asdf').should == 'asdf'
409
+ expect(helper.facet_display_value('simple_field', 'asdf')).to eq 'asdf'
410
410
  end
411
411
 
412
412
  it "should allow you to pass in a :helper_method argument to the configuration" do
@@ -414,22 +414,22 @@ describe FacetsHelper do
414
414
 
415
415
  helper.should_receive(:my_facet_value_renderer).with('qwerty').and_return('abc')
416
416
 
417
- helper.facet_display_value('helper_field', 'qwerty').should == 'abc'
417
+ expect(helper.facet_display_value('helper_field', 'qwerty')).to eq 'abc'
418
418
  end
419
419
 
420
420
  it "should extract the configuration label for a query facet" do
421
421
  helper.stub(:facet_configuration_for_field).with('query_facet').and_return(double(:query => { 'query_key' => { :label => 'XYZ'}}, :date => nil, :helper_method => nil))
422
- helper.facet_display_value('query_facet', 'query_key').should == 'XYZ'
422
+ expect(helper.facet_display_value('query_facet', 'query_key')).to eq 'XYZ'
423
423
  end
424
424
 
425
425
  it "should localize the label for date-type facets" do
426
426
  helper.stub(:facet_configuration_for_field).with('date_facet').and_return(double('date' => true, :query => nil, :helper_method => nil))
427
- helper.facet_display_value('date_facet', '2012-01-01').should == 'Sun, 01 Jan 2012 00:00:00 +0000'
427
+ expect(helper.facet_display_value('date_facet', '2012-01-01')).to eq 'Sun, 01 Jan 2012 00:00:00 +0000'
428
428
  end
429
429
 
430
430
  it "should localize the label for date-type facets with the supplied localization options" do
431
431
  helper.stub(:facet_configuration_for_field).with('date_facet').and_return(double('date' => { :format => :short }, :query => nil, :helper_method => nil))
432
- helper.facet_display_value('date_facet', '2012-01-01').should == '01 Jan 00:00'
432
+ expect(helper.facet_display_value('date_facet', '2012-01-01')).to eq '01 Jan 00:00'
433
433
  end
434
434
  end
435
435
  end
@@ -1,5 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
3
2
 
4
3
  describe HashAsHiddenFieldsHelper do
5
4
  include HashAsHiddenFieldsHelper
@@ -11,13 +10,13 @@ describe HashAsHiddenFieldsHelper do
11
10
 
12
11
  generated = hash_as_hidden_fields(@hash)
13
12
 
14
- generated.should have_selector("input[type='hidden'][name='q'][value='query']")
15
- generated.should have_selector("input[type='hidden'][name='per_page'][value='10']")
16
- generated.should have_selector("input[type='hidden'][name='page'][value='5']")
17
- generated.should have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
18
- generated.should have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
19
- generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
20
- generated.should have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
13
+ expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']")
14
+ expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']")
15
+ expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']")
16
+ expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
17
+ expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
18
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
19
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
21
20
 
22
21
  end
23
22
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe RenderConstraintsHelper do
4
4
 
@@ -9,7 +9,7 @@ describe RenderConstraintsHelper do
9
9
 
10
10
  describe '#render_constraints_query' do
11
11
  it "should have a link relative to the current url" do
12
- helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/?f%5Btype%5D=journal']"
12
+ expect(helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'})).to have_selector "a[href='/?f%5Btype%5D=journal']"
13
13
  end
14
14
  end
15
15
 
@@ -23,7 +23,7 @@ describe RenderConstraintsHelper do
23
23
  it "should have a link relative to the current url" do
24
24
  result = helper.render_filter_element('type', ['journal'], {:q=>'biz'})
25
25
  # I'm not certain how the ampersand gets in there. It's not important.
26
- result.should have_selector "a[href='/?&q=biz']"
26
+ expect(result).to have_selector "a[href='/?&q=biz']"
27
27
  end
28
28
  end
29
29
 
@@ -1,5 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
3
2
 
4
3
  describe SearchHistoryConstraintsHelper do
5
4
 
@@ -21,10 +20,10 @@ describe SearchHistoryConstraintsHelper do
21
20
  it "should render basic element" do
22
21
  response = helper.render_search_to_s_element("key", "value")
23
22
  response.should have_selector("span.constraint") do |span|
24
- span.should have_selector("span.filterName", :content => "key:")
25
- span.should have_selector("span.filterValue", :content => "value")
23
+ expect(span).to have_selector("span.filterName", :content => "key:")
24
+ expect(span).to have_selector("span.filterValue", :content => "value")
26
25
  end
27
- response.html_safe?.should == true
26
+ expect(response).to be_html_safe
28
27
  end
29
28
  it "should escape them that need escaping" do
30
29
  response = helper.render_search_to_s_element("key>", "value>")
@@ -33,21 +32,21 @@ describe SearchHistoryConstraintsHelper do
33
32
  # Note: nokogiri's gettext will unescape the inner html
34
33
  # which seems to be what rspecs "contains" method calls on
35
34
  # text nodes - thus the to_s inserted below.
36
- s2.to_s.should match(/key&gt;:/)
35
+ expect(s2).to match(/key&gt;:/)
37
36
  end
38
37
  span.should have_selector("span.filterValue") do |s3|
39
- s3.to_s.should match(/value&gt;/)
38
+ expect(s3).to match(/value&gt;/)
40
39
  end
41
40
  end
42
- response.html_safe?.should == true
41
+ expect(response).to be_html_safe
43
42
  end
44
43
  it "should not escape with options set thus" do
45
44
  response = helper.render_search_to_s_element("key>", "value>", :escape_key => false, :escape_value => false)
46
45
  response.should have_selector("span.constraint") do |span|
47
- span.should have_selector("span.filterName", :content => "key>:")
48
- span.should have_selector("span.filterValue", :content => "value>")
46
+ expect(span).to have_selector("span.filterName", :content => "key>:")
47
+ expect(span).to have_selector("span.filterValue", :content => "value>")
49
48
  end
50
- response.html_safe?.should == true
49
+ expect(response).to be_html_safe
51
50
  end
52
51
  end
53
52
 
@@ -62,9 +61,9 @@ describe SearchHistoryConstraintsHelper do
62
61
  # API hooks expect this to be so
63
62
  response = helper.render_search_to_s(@params)
64
63
 
65
- response.should include( helper.render_search_to_s_q(@params))
66
- response.should include( helper.render_search_to_s_filters(@params))
67
- response.html_safe?.should == true
64
+ expect(response).to include( helper.render_search_to_s_q(@params))
65
+ expect(response).to include( helper.render_search_to_s_filters(@params))
66
+ expect(response).to be_html_safe
68
67
  end
69
68
  end
70
69