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,6 +1,4 @@
1
- #ste -*- encoding : utf-8 -*-
2
- # -*- coding: UTF-8 -*-
3
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
4
2
 
5
3
  describe "Blacklight::Configurable" do
6
4
 
@@ -56,7 +54,7 @@ describe "Blacklight::Configurable" do
56
54
  Blacklight::Configurable.default_configuration = Blacklight::Configuration.new :a => 1
57
55
 
58
56
  a.send(:include, Blacklight::Configurable)
59
- a.blacklight_config.a.should == 1
57
+ expect(a.blacklight_config.a).to eq 1
60
58
  end
61
59
 
62
60
  it "has configure_blacklight convenience method" do
@@ -67,7 +65,7 @@ describe "Blacklight::Configurable" do
67
65
  config.my_key = 'value'
68
66
  end
69
67
 
70
- klass.blacklight_config.my_key.should == 'value'
68
+ expect(klass.blacklight_config.my_key).to eq 'value'
71
69
  end
72
70
 
73
71
  it "allows the instance to set a radically different config from the class" do
@@ -78,8 +76,8 @@ describe "Blacklight::Configurable" do
78
76
  instance = klass.new
79
77
  instance.blacklight_config = Blacklight::Configuration.new
80
78
 
81
- instance.blacklight_config.should_not == klass.blacklight_config
82
- instance.blacklight_config.foo.should be_nil
79
+ expect(instance.blacklight_config).to_not eq klass.blacklight_config
80
+ expect(instance.blacklight_config.foo).to be_nil
83
81
  end
84
82
 
85
83
  it "allows instance to set it's own config seperate from class" do
@@ -94,11 +92,11 @@ describe "Blacklight::Configurable" do
94
92
 
95
93
  instance = klass.new
96
94
  instance.blacklight_config.bar << "123"
97
- instance.blacklight_config.should_not == klass.blacklight_config
98
- klass.blacklight_config.foo.should == "bar"
99
- instance.blacklight_config.foo.should == "bar"
100
- klass.blacklight_config.bar.should_not include("123")
101
- instance.blacklight_config.bar.should include("asd", "123")
95
+ expect(instance.blacklight_config).to_not eq klass.blacklight_config
96
+ expect(klass.blacklight_config.foo).to eq "bar"
97
+ expect(instance.blacklight_config.foo).to eq "bar"
98
+ expect(klass.blacklight_config.bar).to_not include("123")
99
+ expect(instance.blacklight_config.bar).to include("asd", "123")
102
100
  end
103
101
 
104
102
  it "configurable classes should not mutate the default configuration object" do
@@ -110,8 +108,8 @@ describe "Blacklight::Configurable" do
110
108
  klass2.send(:include, Blacklight::Configurable)
111
109
  klass2.blacklight_config.foo = "asdf"
112
110
 
113
- klass.blacklight_config.foo.should == "bar"
114
- klass2.blacklight_config.foo.should == "asdf"
111
+ expect(klass.blacklight_config.foo).to eq "bar"
112
+ expect(klass2.blacklight_config.foo).to eq "asdf"
115
113
  end
116
114
 
117
115
  end
@@ -1,6 +1,4 @@
1
- #ste -*- encoding : utf-8 -*-
2
- # -*- coding: UTF-8 -*-
3
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
4
2
 
5
3
  describe "Blacklight::Configuration" do
6
4
 
@@ -11,8 +9,8 @@ describe "Blacklight::Configuration" do
11
9
  it "should support arbitrary configuration values" do
12
10
  @config.a = 1
13
11
 
14
- @config.a.should == 1
15
- @config[:a].should == 1
12
+ expect(@config.a).to eq 1
13
+ expect(@config[:a]).to eq 1
16
14
  end
17
15
 
18
16
  describe "initialization" do
@@ -23,48 +21,48 @@ describe "Blacklight::Configuration" do
23
21
  it "should accept a block for configuration" do
24
22
  config = Blacklight::Configuration.new(:a => 1) { |c| c.a = 2 }
25
23
 
26
- config.a.should == 2
24
+ expect(config.a).to eq 2
27
25
 
28
26
  config.configure { |c| c.a = 3 }
29
27
 
30
- config.a.should == 3
28
+ expect(config.a).to eq 3
31
29
  end
32
30
  end
33
31
 
34
32
  describe "defaults" do
35
33
  it "should have a hash of default rsolr query parameters" do
36
- @config.default_solr_params.should be_a_kind_of Hash
34
+ expect(@config.default_solr_params).to be_a_kind_of Hash
37
35
  end
38
36
 
39
37
  it "should have openstruct values for show and index parameters" do
40
- @config.show.should be_a_kind_of OpenStruct
41
- @config.index.should be_a_kind_of OpenStruct
38
+ expect(@config.show).to be_a_kind_of OpenStruct
39
+ expect(@config.index).to be_a_kind_of OpenStruct
42
40
  end
43
41
 
44
42
  it "should introspect SolrDocument for sensible defaults for show + index" do
45
- @config.show.html_title.should == 'id'
46
- @config.show.heading.should == 'id'
47
- @config.index.show_link.should == 'id'
43
+ expect(@config.show.html_title).to eq'id'
44
+ expect(@config.show.heading).to eq 'id'
45
+ expect(@config.index.show_link).to eq'id'
48
46
  end
49
47
 
50
48
  it "should have ordered hashes for field configuration" do
51
- @config.facet_fields.should be_a_kind_of ActiveSupport::OrderedHash
52
- @config.index_fields.should be_a_kind_of ActiveSupport::OrderedHash
53
- @config.show_fields.should be_a_kind_of ActiveSupport::OrderedHash
54
- @config.search_fields.should be_a_kind_of ActiveSupport::OrderedHash
55
- @config.show_fields.should be_a_kind_of ActiveSupport::OrderedHash
56
- @config.search_fields.should be_a_kind_of ActiveSupport::OrderedHash
57
- @config.sort_fields.should be_a_kind_of ActiveSupport::OrderedHash
49
+ expect(@config.facet_fields).to be_a_kind_of ActiveSupport::OrderedHash
50
+ expect(@config.index_fields).to be_a_kind_of ActiveSupport::OrderedHash
51
+ expect(@config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
52
+ expect(@config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
53
+ expect(@config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
54
+ expect(@config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
55
+ expect(@config.sort_fields).to be_a_kind_of ActiveSupport::OrderedHash
58
56
  end
59
57
  end
60
58
 
61
59
  describe "spell_max" do
62
60
  it "should default to 5" do
63
- Blacklight::Configuration.new.spell_max.should == 5
61
+ expect(Blacklight::Configuration.new.spell_max).to eq 5
64
62
  end
65
63
 
66
64
  it "should accept config'd value" do
67
- Blacklight::Configuration.new(:spell_max => 10).spell_max.should == 10
65
+ expect(Blacklight::Configuration.new(:spell_max => 10).spell_max).to eq 10
68
66
  end
69
67
  end
70
68
 
@@ -76,8 +74,8 @@ describe "Blacklight::Configuration" do
76
74
  @mock_facet = Blacklight::Configuration::FacetField.new
77
75
  config_copy.add_facet_field "dummy_field", @mock_facet
78
76
 
79
- @config.a.should be_nil
80
- @config.facet_fields.should_not include(@mock_facet)
77
+ expect(@config.a).to be_nil
78
+ expect(@config.facet_fields).to_not include(@mock_facet)
81
79
  end
82
80
  end
83
81
 
@@ -91,7 +89,7 @@ describe "Blacklight::Configuration" do
91
89
 
92
90
 
93
91
 
94
- config.my_custom_fields.keys.should include('qwerty')
92
+ expect(config.my_custom_fields.keys).to include('qwerty')
95
93
  end
96
94
 
97
95
  it "should let you define a field accessor that uses an existing field-type" do
@@ -104,7 +102,7 @@ describe "Blacklight::Configuration" do
104
102
 
105
103
 
106
104
 
107
- config.my_custom_facet_fields['qwerty'].should be_a_kind_of(Blacklight::Configuration::FacetField)
105
+ expect(config.my_custom_facet_fields['qwerty']).to be_a_kind_of(Blacklight::Configuration::FacetField)
108
106
  end
109
107
 
110
108
  end
@@ -113,16 +111,16 @@ describe "Blacklight::Configuration" do
113
111
  it "should accept field name and hash form arg" do
114
112
  @config.add_facet_field('format', :label => "Format", :limit => true)
115
113
 
116
- @config.facet_fields["format"].should_not be_nil
117
- @config.facet_fields["format"]["label"].should == "Format"
118
- @config.facet_fields["format"]["limit"].should == true
114
+ expect(@config.facet_fields["format"]).to_not be_nil
115
+ expect(@config.facet_fields["format"]["label"]).to eq "Format"
116
+ expect(@config.facet_fields["format"]["limit"]).to be_true
119
117
  end
120
118
 
121
119
  it "should accept FacetField obj arg" do
122
120
  @config.add_facet_field("format", Blacklight::Configuration::FacetField.new( :label => "Format"))
123
121
 
124
- @config.facet_fields["format"].should_not be_nil
125
- @config.facet_fields["format"]["label"].should == "Format"
122
+ expect(@config.facet_fields["format"]).to_not be_nil
123
+ expect(@config.facet_fields["format"]["label"]).to eq "Format"
126
124
  end
127
125
 
128
126
  it "should accept field name and block form" do
@@ -131,8 +129,8 @@ describe "Blacklight::Configuration" do
131
129
  facet.limit = true
132
130
  end
133
131
 
134
- @config.facet_fields["format"].should_not be_nil
135
- @config.facet_fields["format"].limit.should == true
132
+ expect(@config.facet_fields["format"]).to_not be_nil
133
+ expect(@config.facet_fields["format"].limit).to be_true
136
134
  end
137
135
 
138
136
  it "should accept block form" do
@@ -141,34 +139,34 @@ describe "Blacklight::Configuration" do
141
139
  facet.label = "Format"
142
140
  end
143
141
 
144
- @config.facet_fields['format'].should_not be_nil
142
+ expect(@config.facet_fields['format']).to_not be_nil
145
143
  end
146
144
 
147
145
  it "should accept a configuration hash" do
148
146
  @config.add_facet_field :field => 'format', :label => 'Format'
149
- @config.facet_fields['format'].should_not be_nil
147
+ expect(@config.facet_fields['format']).to_not be_nil
150
148
  end
151
149
 
152
150
  it "should accept array form" do
153
151
  @config.add_facet_field([{ :field => 'format', :label => 'Format'}, { :field => 'publication_date', :label => 'Publication Date' }])
154
152
 
155
- @config.facet_fields.length.should == 2
153
+ expect(@config.facet_fields).to have(2).fields
156
154
  end
157
155
 
158
156
  it "should create default label from titleized solr field" do
159
157
  @config.add_facet_field("publication_date")
160
158
 
161
- @config.facet_fields["publication_date"].label.should == "Publication Date"
159
+ expect(@config.facet_fields["publication_date"].label).to eq "Publication Date"
162
160
  end
163
161
 
164
162
  it "should allow you to not show the facet in the facet bar" do
165
163
  @config.add_facet_field("publication_date", :show=>false)
166
164
 
167
- @config.facet_fields["publication_date"]['show'].should be_false
165
+ expect(@config.facet_fields["publication_date"]['show']).to be_false
168
166
  end
169
167
 
170
168
  it "should raise on nil solr field name" do
171
- lambda { @config.add_facet_field(nil) }.should raise_error ArgumentError
169
+ expect { @config.add_facet_field(nil) }.to raise_error ArgumentError
172
170
  end
173
171
 
174
172
  end
@@ -177,31 +175,31 @@ describe "Blacklight::Configuration" do
177
175
  it "takes hash form" do
178
176
  @config.add_index_field("title_display", :label => "Title")
179
177
 
180
- @config.index_fields["title_display"].should_not be_nil
181
- @config.index_fields["title_display"].label.should == "Title"
178
+ expect(@config.index_fields["title_display"]).to_not be_nil
179
+ expect(@config.index_fields["title_display"].label).to eq "Title"
182
180
  end
183
181
  it "takes IndexField param" do
184
182
  @config.add_index_field("title_display", Blacklight::Configuration::IndexField.new(:field => "title_display", :label => "Title"))
185
183
 
186
- @config.index_fields["title_display"].should_not be_nil
187
- @config.index_fields["title_display"].label.should == "Title"
184
+ expect(@config.index_fields["title_display"]).to_not be_nil
185
+ expect(@config.index_fields["title_display"].label).to eq "Title"
188
186
  end
189
187
  it "takes block form" do
190
188
  @config.add_index_field("title_display") do |field|
191
189
  field.label = "Title"
192
190
  end
193
- @config.index_fields["title_display"].should_not be_nil
194
- @config.index_fields["title_display"].label.should == "Title"
191
+ expect(@config.index_fields["title_display"]).to_not be_nil
192
+ expect(@config.index_fields["title_display"].label).to eq "Title"
195
193
  end
196
194
 
197
195
  it "creates default label from titleized field" do
198
196
  @config.add_index_field("title_display")
199
197
 
200
- @config.index_fields["title_display"].label.should == "Title Display"
198
+ expect(@config.index_fields["title_display"].label).to eq "Title Display"
201
199
  end
202
200
 
203
201
  it "should raise on nil solr field name" do
204
- lambda { @config.add_index_field(nil) }.should raise_error ArgumentError
202
+ expect { @config.add_index_field(nil) }.to raise_error ArgumentError
205
203
  end
206
204
 
207
205
  end
@@ -210,32 +208,32 @@ describe "Blacklight::Configuration" do
210
208
  it "takes hash form" do
211
209
  @config.add_show_field("title_display", :label => "Title")
212
210
 
213
- @config.show_fields["title_display"].should_not be_nil
214
- @config.show_fields["title_display"].label.should == "Title"
211
+ expect(@config.show_fields["title_display"]).to_not be_nil
212
+ expect(@config.show_fields["title_display"].label).to eq "Title"
215
213
  end
216
214
  it "takes ShowField argument" do
217
215
  @config.add_show_field("title_display", Blacklight::Configuration::ShowField.new(:field => "title_display", :label => "Title"))
218
216
 
219
- @config.show_fields["title_display"].should_not be_nil
220
- @config.show_fields["title_display"].label.should == "Title"
217
+ expect(@config.show_fields["title_display"]).to_not be_nil
218
+ expect(@config.show_fields["title_display"].label).to eq "Title"
221
219
  end
222
220
  it "takes block form" do
223
221
  @config.add_show_field("title_display") do |f|
224
222
  f.label = "Title"
225
223
  end
226
224
 
227
- @config.show_fields["title_display"].should_not be_nil
228
- @config.show_fields["title_display"].label.should == "Title"
225
+ expect(@config.show_fields["title_display"]).to_not be_nil
226
+ expect(@config.show_fields["title_display"].label).to eq "Title"
229
227
  end
230
228
 
231
229
  it "creates default label humanized from field" do
232
230
  @config.add_show_field("my_custom_field")
233
231
 
234
- @config.show_fields["my_custom_field"].label.should == "My Custom Field"
232
+ expect(@config.show_fields["my_custom_field"].label).to eq "My Custom Field"
235
233
  end
236
234
 
237
235
  it "should raise on nil solr field name" do
238
- lambda { @config.add_show_field(nil) }.should raise_error ArgumentError
236
+ expect { @config.add_show_field(nil) }.to raise_error ArgumentError
239
237
  end
240
238
 
241
239
  end
@@ -258,11 +256,11 @@ describe "Blacklight::Configuration" do
258
256
 
259
257
  field = c.search_fields["my_search_type"]
260
258
 
261
- field.should_not be_nil
259
+ expect(field).to_not be_nil
262
260
 
263
261
 
264
- field.solr_parameters.should_not be_nil
265
- field.solr_local_parameters.should_not be_nil
262
+ expect(field.solr_parameters).to_not be_nil
263
+ expect(field.solr_local_parameters).to_not be_nil
266
264
 
267
265
 
268
266
  end
@@ -277,9 +275,9 @@ describe "Blacklight::Configuration" do
277
275
 
278
276
  f = c.search_fields["some_field"]
279
277
 
280
- f.should_not be_nil
281
- f.solr_parameters.should_not be_nil
282
- f.solr_local_parameters.should_not be_nil
278
+ expect(f).to_not be_nil
279
+ expect(f.solr_parameters).to_not be_nil
280
+ expect(f.solr_local_parameters).to_not be_nil
283
281
  end
284
282
 
285
283
  it "should accept SearchField object" do
@@ -289,17 +287,17 @@ describe "Blacklight::Configuration" do
289
287
 
290
288
  c.add_search_field("foo", f)
291
289
 
292
- c.search_fields["foo"].should_not be_nil
290
+ expect(c.search_fields["foo"]).to_not be_nil
293
291
  end
294
292
 
295
293
  it "should raise on nil key" do
296
- lambda {@config.add_search_field(nil, :foo => "bar")}.should raise_error ArgumentError
294
+ expect {@config.add_search_field(nil, :foo => "bar")}.to raise_error ArgumentError
297
295
  end
298
296
 
299
297
  it "creates default label from titleized field key" do
300
298
  @config.add_search_field("author_name")
301
299
 
302
- @config.search_fields["author_name"].label.should == "Author Name"
300
+ expect(@config.search_fields["author_name"].label).to eq "Author Name"
303
301
  end
304
302
 
305
303
 
@@ -309,20 +307,20 @@ describe "Blacklight::Configuration" do
309
307
  it "should take a hash" do
310
308
  c = Blacklight::Configuration.new
311
309
  c.add_sort_field(:key => "my_sort_key", :sort => "score desc")
312
- c.sort_fields["my_sort_key"].should_not be_nil
310
+ expect(c.sort_fields["my_sort_key"]).to_not be_nil
313
311
  end
314
312
 
315
313
  it "should take a two-arg form with a hash" do
316
314
  @config.add_sort_field("score desc, pub_date_sort desc, title_sort asc", :label => "relevance")
317
315
 
318
316
 
319
- @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
317
+ expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).to_not be_nil
320
318
  end
321
319
 
322
320
  it "should take a SortField object" do
323
321
  @config.add_sort_field(Blacklight::Configuration::SortField.new(:label => "relevance", :sort => "score desc, pub_date_sort desc, title_sort asc"
324
322
  ))
325
- @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
323
+ expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).to_not be_nil
326
324
  end
327
325
 
328
326
  it "should take block form" do
@@ -331,7 +329,7 @@ describe "Blacklight::Configuration" do
331
329
  field.sort = "score desc, pub_date_sort desc, title_sort asc"
332
330
  end
333
331
 
334
- @config.sort_fields.values.find{|f| f.label == "relevance"}.should_not be_nil
332
+ expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).to_not be_nil
335
333
 
336
334
  end
337
335
  end
@@ -341,7 +339,7 @@ describe "Blacklight::Configuration" do
341
339
  @config.add_search_field('search_field_1')
342
340
  @config.add_search_field('search_field_2', :default => true)
343
341
 
344
- @config.default_search_field.key.should == 'search_field_2'
342
+ expect(@config.default_search_field.key).to eq 'search_field_2'
345
343
  end
346
344
  end
347
345
 
@@ -1,7 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
- # Spec tests for Paginator class found in lib/blacklight/solr/facet_paginator.rb
3
-
4
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
5
2
 
6
3
  describe 'Blacklight::Solr::FacetPaginator' do
7
4
  before(:all) do
@@ -18,14 +15,14 @@ describe 'Blacklight::Solr::FacetPaginator' do
18
15
  @paginator = Blacklight::Solr::FacetPaginator.new(@seven_facet_values, :limit => 6)
19
16
  end
20
17
  it 'should have next' do
21
- @paginator.should be_has_next
18
+ expect(@paginator).to have_next
22
19
  end
23
20
 
24
21
  end
25
22
  it 'should not have next when there are fewer results' do
26
23
  paginator = Blacklight::Solr::FacetPaginator.new(@six_facet_values, :offset => 0, :limit => @limit)
27
24
 
28
- paginator.should_not be_has_next
25
+ expect(paginator).not_to have_next
29
26
  end
30
27
  context 'when offset is greater than 0' do
31
28
  before(:each) do
@@ -34,45 +31,45 @@ describe 'Blacklight::Solr::FacetPaginator' do
34
31
  end
35
32
 
36
33
  it 'should have previous' do
37
- @paginator.should be_has_previous
34
+ expect(@paginator).to have_previous
38
35
  end
39
36
 
40
37
  end
41
38
  it 'should not have previous when offset is 0' do
42
39
  paginator = Blacklight::Solr::FacetPaginator.new(@seven_facet_values, :offset => 0, :limit => @limit)
43
40
 
44
- paginator.should_not be_has_previous
41
+ expect(paginator).not_to have_previous
45
42
  end
46
43
  it 'should know a manually set sort, and produce proper sort url' do
47
44
  paginator = Blacklight::Solr::FacetPaginator.new(@seven_facet_values, :offset => 100, :limit => @limit, :sort => 'index')
48
45
 
49
- paginator.sort.should == 'index'
46
+ expect(paginator.sort).to eq 'index'
50
47
 
51
48
  click_params = paginator.params_for_resort_url('count', {})
52
49
 
53
- click_params[ @sort_key ].should == 'count'
54
- click_params[ @page_key ].should be_nil
50
+ expect(click_params[ @sort_key ]).to eq 'count'
51
+ expect(click_params[ @page_key ]).to be_nil
55
52
  end
56
53
  it 'should limit items to limit, if limit is smaller than items.length' do
57
54
  paginator = Blacklight::Solr::FacetPaginator.new(@seven_facet_values, :offset => 100, :limit => 6, :sort => 'index')
58
- paginator.items.length.should == 6
55
+ expect(paginator.items).to have(6).items
59
56
  end
60
57
  it 'should return all items when limit is greater than items.length' do
61
58
  paginator = Blacklight::Solr::FacetPaginator.new(@six_facet_values, :offset => 100, :limit => 6, :sort => 'index')
62
- paginator.items.length.should == 6
59
+ expect(paginator.items).to have(6).items
63
60
  end
64
61
  describe "for a nil :limit" do
65
62
  before(:all) do
66
63
  @paginator = Blacklight::Solr::FacetPaginator.new(@seven_facet_values, :offset => 100, :limit => nil, :sort => 'index')
67
64
  end
68
65
  it 'should return all items' do
69
- @paginator.items.should == @seven_facet_values
66
+ expect(@paginator.items).to eq @seven_facet_values
70
67
  end
71
68
  it 'should not has_next?' do
72
- @paginator.should_not be_has_next
69
+ expect(@paginator).not_to have_next
73
70
  end
74
71
  it 'should not has_previous?' do
75
- @paginator.should_not be_has_previous
72
+ expect(@paginator).not_to have_previous
76
73
  end
77
74
  end
78
75