blacklight 6.2.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.solr_wrapper +5 -0
  4. data/.travis.yml +3 -5
  5. data/Gemfile +3 -3
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/blacklight/core.js +19 -5
  8. data/app/helpers/blacklight/blacklight_helper_behavior.rb +48 -20
  9. data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -1
  10. data/app/helpers/blacklight/url_helper_behavior.rb +2 -1
  11. data/app/presenters/blacklight/document_presenter.rb +58 -150
  12. data/app/presenters/blacklight/field_presenter.rb +31 -0
  13. data/app/presenters/blacklight/index_presenter.rb +69 -0
  14. data/app/presenters/blacklight/link_alternate_presenter.rb +29 -0
  15. data/app/presenters/blacklight/rendering/abstract_step.rb +24 -0
  16. data/app/presenters/blacklight/rendering/helper_method.rb +23 -0
  17. data/app/presenters/blacklight/rendering/join.rb +16 -0
  18. data/app/presenters/blacklight/rendering/link_to_facet.rb +35 -0
  19. data/app/presenters/blacklight/rendering/microdata.rb +17 -0
  20. data/app/presenters/blacklight/rendering/pipeline.rb +32 -0
  21. data/app/presenters/blacklight/rendering/terminator.rb +9 -0
  22. data/app/presenters/blacklight/show_presenter.rb +93 -0
  23. data/app/services/blacklight/field_retriever.rb +58 -0
  24. data/app/views/catalog/_document_default.atom.builder +2 -3
  25. data/app/views/catalog/_document_default.rss.builder +2 -2
  26. data/app/views/kaminari/blacklight/_next_page.html.erb +9 -3
  27. data/app/views/kaminari/blacklight/_prev_page.html.erb +10 -3
  28. data/lib/blacklight/configuration.rb +15 -3
  29. data/lib/blacklight/configuration/null_field.rb +13 -0
  30. data/lib/blacklight/configuration/view_config.rb +6 -0
  31. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -1
  32. data/lib/generators/blacklight/templates/config/blacklight.yml +1 -1
  33. data/lib/generators/blacklight/templates/config/jetty.yml +1 -1
  34. data/spec/controllers/alternate_controller_spec.rb +2 -2
  35. data/spec/controllers/application_controller_spec.rb +1 -1
  36. data/spec/controllers/blacklight/facet_spec.rb +3 -3
  37. data/spec/controllers/blacklight/search_fields_spec.rb +7 -7
  38. data/spec/controllers/blacklight/search_helper_spec.rb +44 -44
  39. data/spec/controllers/blacklight/suggest_search_spec.rb +1 -1
  40. data/spec/controllers/bookmarks_controller_spec.rb +6 -6
  41. data/spec/controllers/catalog_controller_spec.rb +125 -125
  42. data/spec/controllers/saved_searches_controller_spec.rb +4 -9
  43. data/spec/controllers/search_history_controller_spec.rb +3 -6
  44. data/spec/controllers/suggest_controller_spec.rb +2 -2
  45. data/spec/features/alternate_controller_spec.rb +3 -3
  46. data/spec/features/bookmarks_spec.rb +6 -6
  47. data/spec/features/did_you_mean_spec.rb +10 -10
  48. data/spec/features/facets_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +4 -4
  50. data/spec/features/saved_searches_spec.rb +4 -4
  51. data/spec/features/search_context_spec.rb +4 -4
  52. data/spec/features/search_filters_spec.rb +10 -10
  53. data/spec/features/search_formats_spec.rb +2 -2
  54. data/spec/features/search_history_spec.rb +5 -5
  55. data/spec/features/search_pagination_spec.rb +4 -4
  56. data/spec/features/search_results_spec.rb +7 -7
  57. data/spec/features/search_sort_spec.rb +2 -2
  58. data/spec/features/search_spec.rb +6 -6
  59. data/spec/helpers/blacklight_helper_spec.rb +105 -65
  60. data/spec/helpers/catalog_helper_spec.rb +36 -36
  61. data/spec/helpers/configuration_helper_spec.rb +28 -28
  62. data/spec/helpers/facets_helper_spec.rb +39 -39
  63. data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
  64. data/spec/helpers/render_constraints_helper_spec.rb +1 -1
  65. data/spec/helpers/search_history_constraints_helper_spec.rb +7 -7
  66. data/spec/helpers/url_helper_spec.rb +20 -17
  67. data/spec/lib/blacklight/search_state_spec.rb +2 -2
  68. data/spec/lib/blacklight/utils_spec.rb +15 -15
  69. data/spec/lib/blacklight_spec.rb +1 -1
  70. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  71. data/spec/models/blacklight/configurable_spec.rb +3 -3
  72. data/spec/models/blacklight/configuration_spec.rb +52 -52
  73. data/spec/models/blacklight/document_spec.rb +10 -10
  74. data/spec/models/blacklight/facet_paginator_spec.rb +5 -5
  75. data/spec/models/blacklight/search_builder_spec.rb +34 -34
  76. data/spec/models/blacklight/user_spec.rb +4 -4
  77. data/spec/models/bookmark_spec.rb +5 -5
  78. data/spec/models/record_mailer_spec.rb +11 -11
  79. data/spec/models/search_spec.rb +1 -1
  80. data/spec/models/solr_document_spec.rb +4 -4
  81. data/spec/presenters/document_presenter_spec.rb +94 -50
  82. data/spec/presenters/index_presenter_spec.rb +147 -0
  83. data/spec/presenters/pipeline_spec.rb +28 -0
  84. data/spec/presenters/show_presenter_spec.rb +287 -0
  85. data/spec/routing/catalog_routing_spec.rb +11 -11
  86. data/spec/spec_helper.rb +10 -1
  87. data/spec/support/backport_test.rb +38 -0
  88. data/spec/test_app_templates/Gemfile.extra +2 -10
  89. data/spec/views/_user_util_links.html.erb_spec.rb +1 -1
  90. data/spec/views/catalog/_constraints.html.erb_spec.rb +3 -3
  91. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +5 -5
  92. data/spec/views/catalog/_document.html.erb_spec.rb +2 -2
  93. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  94. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +4 -4
  95. data/spec/views/catalog/_facets.html.erb_spec.rb +4 -4
  96. data/spec/views/catalog/_index_default.erb_spec.rb +5 -4
  97. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +4 -3
  98. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -3
  99. data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
  100. data/spec/views/catalog/_show_default.erb_spec.rb +6 -5
  101. data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -1
  102. data/spec/views/catalog/_show_tools.html.erb_spec.rb +8 -8
  103. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +2 -2
  104. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -2
  105. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -3
  106. data/spec/views/catalog/facet.html.erb_spec.rb +3 -3
  107. data/spec/views/catalog/index.atom.builder_spec.rb +15 -14
  108. data/spec/views/catalog/index.html.erb_spec.rb +3 -3
  109. data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -1
  110. data/spec/views/catalog/show.html.erb_spec.rb +5 -4
  111. data/tasks/blacklight.rake +1 -1
  112. metadata +25 -4
  113. data/config/jetty.yml +0 -13
@@ -71,7 +71,7 @@ describe Blacklight::SearchState do
71
71
 
72
72
  context "with a block" do
73
73
  let(:params) { parameter_class.new a: 1, b: 2 }
74
- it "should evalute the block and allow it to add or remove keys" do
74
+ it "evalutes the block and allow it to add or remove keys" do
75
75
  result = helper.params_for_search(c: 3) do |params|
76
76
  params.extract! :a, :b
77
77
  params[:d] = 'd'
@@ -177,7 +177,7 @@ describe Blacklight::SearchState do
177
177
  expect(result_params[:f]['facet_field_2']).to include(123)
178
178
  end
179
179
 
180
- it "should add any extra fq parameters from the FacetItem" do
180
+ it "adds any extra fq parameters from the FacetItem" do
181
181
  result_params = helper.add_facet_params('facet_field_1', double(:value => 123, fq: { 'facet_field_2' => 'abc' }))
182
182
 
183
183
  expect(result_params[:f]['facet_field_1']).to include(123)
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe 'Blacklight::Utils' do
5
5
  describe Blacklight::OpenStructWithHashAccess do
6
- it "should provide hash-like accessors for OpenStruct data" do
6
+ it "provides hash-like accessors for OpenStruct data" do
7
7
  a = Blacklight::OpenStructWithHashAccess.new :foo => :bar, :baz => 1
8
8
 
9
9
  expect(a[:foo]).to eq :bar
@@ -11,7 +11,7 @@ describe 'Blacklight::Utils' do
11
11
  expect(a[:asdf]).to be_nil
12
12
  end
13
13
 
14
- it "should provide hash-like writers for OpenStruct data" do
14
+ it "provides hash-like writers for OpenStruct data" do
15
15
  a = Blacklight::OpenStructWithHashAccess.new :foo => :bar, :baz => 1
16
16
 
17
17
  a[:asdf] = 'qwerty'
@@ -19,7 +19,7 @@ describe 'Blacklight::Utils' do
19
19
 
20
20
  end
21
21
 
22
- it "should treat symbols and strings interchangeably in hash access" do
22
+ it "treats symbols and strings interchangeably in hash access" do
23
23
  h = Blacklight::OpenStructWithHashAccess.new
24
24
 
25
25
  h["string"] = "value"
@@ -38,12 +38,12 @@ describe 'Blacklight::Utils' do
38
38
  @h[:b] = 2
39
39
  end
40
40
 
41
- it "should expose the internal hash table" do
41
+ it "exposes the internal hash table" do
42
42
  expect(@h.to_h).to be_a_kind_of(Hash)
43
43
  expect(@h.to_h[:a]).to eq 1
44
44
  end
45
45
 
46
- it "should expose keys" do
46
+ it "exposes keys" do
47
47
  expect(@h.keys).to include(:a, :b)
48
48
  end
49
49
 
@@ -78,7 +78,7 @@ describe 'Blacklight::Utils' do
78
78
  describe "#sort_by" do
79
79
  subject { Blacklight::OpenStructWithHashAccess.new c: 3, b:1, a: 2 }
80
80
 
81
- it "should sort the underlying hash" do
81
+ it "sorts the underlying hash" do
82
82
  sorted = subject.sort_by { |k,v| v }
83
83
  expect(sorted.keys).to match_array [:b, :a, :c]
84
84
  end
@@ -87,7 +87,7 @@ describe 'Blacklight::Utils' do
87
87
  describe "#sort_by!" do
88
88
  subject { Blacklight::OpenStructWithHashAccess.new c: 3, b:1, a: 2 }
89
89
 
90
- it "should sort the underlying hash" do
90
+ it "sorts the underlying hash" do
91
91
  subject.sort_by! { |k,v| v }
92
92
  expect(subject.keys).to match_array [:b, :a, :c]
93
93
  end
@@ -101,11 +101,11 @@ describe 'Blacklight::Utils' do
101
101
  @h[:b] = 2
102
102
  end
103
103
 
104
- it "should merge the object with a hash" do
104
+ it "merges the object with a hash" do
105
105
  expect(@h.merge(:a => 'a')[:a]).to eq 'a'
106
106
  end
107
107
 
108
- it "should merge the object with another struct" do
108
+ it "merges the object with another struct" do
109
109
  expect(@h.merge(Blacklight::OpenStructWithHashAccess.new(:a => 'a'))[:a]).to eq 'a'
110
110
  end
111
111
  end
@@ -119,12 +119,12 @@ describe 'Blacklight::Utils' do
119
119
  @h[:b] = 2
120
120
  end
121
121
 
122
- it "should merge the object with a hash" do
122
+ it "merges the object with a hash" do
123
123
  @h.merge!(:a => 'a')
124
124
  expect(@h[:a]).to eq 'a'
125
125
  end
126
126
 
127
- it "should merge the object with another struct" do
127
+ it "merges the object with another struct" do
128
128
  @h.merge!(Blacklight::OpenStructWithHashAccess.new(:a => 'a'))
129
129
  expect(@h[:a]).to eq 'a'
130
130
  end
@@ -133,7 +133,7 @@ describe 'Blacklight::Utils' do
133
133
  describe "#to_json" do
134
134
  subject { Blacklight::OpenStructWithHashAccess.new a: 1, b: 2}
135
135
 
136
- it "should serialize as json" do
136
+ it "serializes as json" do
137
137
  expect(subject.to_json).to eq ({a: 1, b:2}).to_json
138
138
  end
139
139
  end
@@ -141,7 +141,7 @@ describe 'Blacklight::Utils' do
141
141
  describe "#deep_dup" do
142
142
  subject { Blacklight::OpenStructWithHashAccess.new a: 1, b: { c: 1} }
143
143
 
144
- it "should duplicate nested hashes" do
144
+ it "duplicates nested hashes" do
145
145
  copy = subject.deep_dup
146
146
  copy.a = 2
147
147
  copy.b[:c] = 2
@@ -152,11 +152,11 @@ describe 'Blacklight::Utils' do
152
152
  expect(copy.b[:c]).to eq 2
153
153
  end
154
154
 
155
- it "should preserve the current class" do
155
+ it "preserves the current class" do
156
156
  expect(Blacklight::NestedOpenStructWithHashAccess.new(Blacklight::NestedOpenStructWithHashAccess).deep_dup).to be_a_kind_of Blacklight::NestedOpenStructWithHashAccess
157
157
  end
158
158
 
159
- it "should preserve the default proc" do
159
+ it "preserves the default proc" do
160
160
  nested = Blacklight::NestedOpenStructWithHashAccess.new Hash
161
161
 
162
162
  copy = nested.deep_dup
@@ -5,7 +5,7 @@ describe Blacklight do
5
5
  context 'root' do
6
6
  let(:blroot) { File.expand_path(File.join(__FILE__, '..', '..', '..' )) }
7
7
 
8
- it 'should return the full path to the BL plugin' do
8
+ it 'returns the full path to the BL plugin' do
9
9
  expect(Blacklight.root).to eq blroot
10
10
  end
11
11
  end
@@ -12,7 +12,7 @@ describe "blacklight:delete_old_searches" do
12
12
  @task_name = "blacklight:delete_old_searches"
13
13
  end
14
14
 
15
- it "should call Search.delete_old_searches" do
15
+ it "calls Search.delete_old_searches" do
16
16
  days_old = 7
17
17
  allow(Search).to receive(:delete_old_searches).with(days_old)
18
18
  @rake[@task_name].invoke(days_old)
@@ -18,7 +18,7 @@ describe "Blacklight::Configurable" do
18
18
  end
19
19
  end
20
20
  end
21
- it "should inherit the configuration when subclassed" do
21
+ it "inherits the configuration when subclassed" do
22
22
  expect(TestCaseInheritence::Child.blacklight_config.list).to include(1,2,3)
23
23
  end
24
24
 
@@ -42,14 +42,14 @@ describe "Blacklight::Configurable" do
42
42
  Blacklight::Configurable.default_configuration = nil
43
43
  end
44
44
 
45
- it "should load an empty configuration" do
45
+ it "loads an empty configuration" do
46
46
  a = Class.new
47
47
  a.send(:include, Blacklight::Configurable)
48
48
 
49
49
  expect(a.blacklight_config.default_solr_params).to be_empty
50
50
  end
51
51
 
52
- it "should allow the user to provide a default configuration" do
52
+ it "allows the user to provide a default configuration" do
53
53
  a = Class.new
54
54
 
55
55
  Blacklight::Configurable.default_configuration = Blacklight::Configuration.new :a => 1
@@ -7,7 +7,7 @@ describe "Blacklight::Configuration" do
7
7
  @config = Blacklight::Configuration.new
8
8
  end
9
9
 
10
- it "should support arbitrary configuration values" do
10
+ it "supports arbitrary configuration values" do
11
11
  @config.a = 1
12
12
 
13
13
  expect(@config.a).to eq 1
@@ -15,11 +15,11 @@ describe "Blacklight::Configuration" do
15
15
  end
16
16
 
17
17
  describe "initialization" do
18
- it "should be an OpenStructWithHashAccess" do
18
+ it "is an OpenStructWithHashAccess" do
19
19
  expect(@config).to be_a_kind_of Blacklight::OpenStructWithHashAccess
20
20
  end
21
21
 
22
- it "should accept a block for configuration" do
22
+ it "accepts a block for configuration" do
23
23
  config = Blacklight::Configuration.new(:a => 1) { |c| c.a = 2 }
24
24
 
25
25
  expect(config.a).to eq 2
@@ -31,16 +31,16 @@ describe "Blacklight::Configuration" do
31
31
  end
32
32
 
33
33
  describe "defaults" do
34
- it "should have a hash of default rsolr query parameters" do
34
+ it "has a hash of default rsolr query parameters" do
35
35
  expect(@config.default_solr_params).to be_a_kind_of Hash
36
36
  end
37
37
 
38
- it "should have openstruct values for show and index parameters" do
38
+ it "has openstruct values for show and index parameters" do
39
39
  expect(@config.show).to be_a_kind_of OpenStruct
40
40
  expect(@config.index).to be_a_kind_of OpenStruct
41
41
  end
42
42
 
43
- it "should have ordered hashes for field configuration" do
43
+ it "has ordered hashes for field configuration" do
44
44
  expect(@config.facet_fields).to be_a_kind_of ActiveSupport::OrderedHash
45
45
  expect(@config.index_fields).to be_a_kind_of ActiveSupport::OrderedHash
46
46
  expect(@config.show_fields).to be_a_kind_of ActiveSupport::OrderedHash
@@ -54,17 +54,17 @@ describe "Blacklight::Configuration" do
54
54
 
55
55
  describe "#connection_config" do
56
56
  let(:custom_config) { double }
57
- it "should have the global blacklight configuration" do
57
+ it "has the global blacklight configuration" do
58
58
  expect(@config.connection_config).to eq Blacklight.connection_config
59
59
  end
60
- it "should be overridable with custom configuration" do
60
+ it "is overridable with custom configuration" do
61
61
  @config.connection_config = custom_config
62
62
  expect(@config.connection_config).to eq custom_config
63
63
  end
64
64
  end
65
65
 
66
66
  describe "config.index.respond_to" do
67
- it "should have a list of additional formats for index requests to respond to" do
67
+ it "has a list of additional formats for index requests to respond to" do
68
68
  @config.index.respond_to.xml = true
69
69
 
70
70
  @config.index.respond_to.csv = { :layout => false }
@@ -76,17 +76,17 @@ describe "Blacklight::Configuration" do
76
76
  end
77
77
 
78
78
  describe "spell_max" do
79
- it "should default to 5" do
79
+ it "defaults to 5" do
80
80
  expect(Blacklight::Configuration.new.spell_max).to eq 5
81
81
  end
82
82
 
83
- it "should accept config'd value" do
83
+ it "accepts config'd value" do
84
84
  expect(Blacklight::Configuration.new(:spell_max => 10).spell_max).to eq 10
85
85
  end
86
86
  end
87
87
 
88
88
  describe "inheritable_copy" do
89
- it "should provide a deep copy of the configuration" do
89
+ it "provides a deep copy of the configuration" do
90
90
  config_copy = @config.inheritable_copy
91
91
  config_copy.a = 1
92
92
 
@@ -98,7 +98,7 @@ describe "Blacklight::Configuration" do
98
98
  end
99
99
 
100
100
  context "when model classes are customised" do
101
- it "should not dup response_model or document_model" do
101
+ it "does not dup response_model or document_model" do
102
102
  @config.response_model = Hash
103
103
  @config.document_model = Array
104
104
 
@@ -110,14 +110,14 @@ describe "Blacklight::Configuration" do
110
110
  end
111
111
 
112
112
  context "when model classes are not set" do
113
- it "should leave response_model and document_model empty" do
113
+ it "leaves response_model and document_model empty" do
114
114
  config_copy = @config.inheritable_copy
115
115
 
116
116
  expect(config_copy.fetch(:response_model, nil)).to be_nil
117
117
  expect(config_copy.fetch(:document_model, nil)).to be_nil
118
118
  end
119
119
 
120
- it "should return default classes" do
120
+ it "returns default classes" do
121
121
  config_copy = @config.inheritable_copy
122
122
 
123
123
  expect(config_copy.response_model).to eq Blacklight::Solr::Response
@@ -125,7 +125,7 @@ describe "Blacklight::Configuration" do
125
125
  end
126
126
  end
127
127
 
128
- it "should provide cloned copies of mutable data structures" do
128
+ it "provides cloned copies of mutable data structures" do
129
129
  @config.a = { value: 1 }
130
130
  @config.b = [1,2,3]
131
131
 
@@ -142,7 +142,7 @@ describe "Blacklight::Configuration" do
142
142
  end
143
143
 
144
144
  describe "add alternative solr fields" do
145
- it "should let you define any arbitrary solr field" do
145
+ it "lets you define any arbitrary solr field" do
146
146
  Blacklight::Configuration.define_field_access :my_custom_field
147
147
 
148
148
  config = Blacklight::Configuration.new do |config|
@@ -154,7 +154,7 @@ describe "Blacklight::Configuration" do
154
154
  expect(config.my_custom_fields.keys).to include('qwerty')
155
155
  end
156
156
 
157
- it "should let you define a field accessor that uses an existing field-type" do
157
+ it "lets you define a field accessor that uses an existing field-type" do
158
158
 
159
159
  Blacklight::Configuration.define_field_access :my_custom_facet_field, :class => Blacklight::Configuration::FacetField
160
160
 
@@ -170,7 +170,7 @@ describe "Blacklight::Configuration" do
170
170
  end
171
171
 
172
172
  describe "add_facet_field" do
173
- it "should accept field name and hash form arg" do
173
+ it "accepts field name and hash form arg" do
174
174
  @config.add_facet_field('format', :label => "Format", :limit => true)
175
175
 
176
176
  expect(@config.facet_fields["format"]).to_not be_nil
@@ -178,14 +178,14 @@ describe "Blacklight::Configuration" do
178
178
  expect(@config.facet_fields["format"]["limit"]).to be true
179
179
  end
180
180
 
181
- it "should accept FacetField obj arg" do
181
+ it "accepts FacetField obj arg" do
182
182
  @config.add_facet_field("format", Blacklight::Configuration::FacetField.new( :label => "Format"))
183
183
 
184
184
  expect(@config.facet_fields["format"]).to_not be_nil
185
185
  expect(@config.facet_fields["format"]["label"]).to eq "Format"
186
186
  end
187
187
 
188
- it "should accept field name and block form" do
188
+ it "accepts field name and block form" do
189
189
  @config.add_facet_field("format") do |facet|
190
190
  facet.label = "Format"
191
191
  facet.limit = true
@@ -195,7 +195,7 @@ describe "Blacklight::Configuration" do
195
195
  expect(@config.facet_fields["format"].limit).to be true
196
196
  end
197
197
 
198
- it "should accept block form" do
198
+ it "accepts block form" do
199
199
  @config.add_facet_field do |facet|
200
200
  facet.field = "format"
201
201
  facet.label = "Format"
@@ -204,41 +204,41 @@ describe "Blacklight::Configuration" do
204
204
  expect(@config.facet_fields['format']).to_not be_nil
205
205
  end
206
206
 
207
- it "should accept a configuration hash" do
207
+ it "accepts a configuration hash" do
208
208
  @config.add_facet_field :field => 'format', :label => 'Format'
209
209
  expect(@config.facet_fields['format']).to_not be_nil
210
210
  end
211
211
 
212
- it "should accept array form" do
212
+ it "accepts array form" do
213
213
  @config.add_facet_field([{ :field => 'format', :label => 'Format'}, { :field => 'publication_date', :label => 'Publication Date' }])
214
214
 
215
215
  expect(@config.facet_fields).to have(2).fields
216
216
  end
217
217
 
218
- it "should accept array form with a block" do
218
+ it "accepts array form with a block" do
219
219
  expect do |b|
220
220
  @config.add_facet_field([{ :field => 'format', :label => 'Format'}, { :field => 'publication_date', :label => 'Publication Date' }], &b)
221
221
  end.to yield_control.twice
222
222
  end
223
223
 
224
224
 
225
- it "should create default label from titleized solr field" do
225
+ it "creates default label from titleized solr field" do
226
226
  @config.add_facet_field("publication_date")
227
227
 
228
228
  expect(@config.facet_fields["publication_date"].label).to eq "Publication Date"
229
229
  end
230
230
 
231
- it "should allow you to not show the facet in the facet bar" do
231
+ it "allows you to not show the facet in the facet bar" do
232
232
  @config.add_facet_field("publication_date", :show=>false)
233
233
 
234
234
  expect(@config.facet_fields["publication_date"]['show']).to be false
235
235
  end
236
236
 
237
- it "should raise on nil solr field name" do
237
+ it "raises on nil solr field name" do
238
238
  expect { @config.add_facet_field(nil) }.to raise_error ArgumentError
239
239
  end
240
240
 
241
- it "should look up and match field names" do
241
+ it "looks up and match field names" do
242
242
  allow(@config).to receive_messages(luke_fields: {
243
243
  "some_field_facet" => {},
244
244
  "another_field_facet" => {},
@@ -249,7 +249,7 @@ describe "Blacklight::Configuration" do
249
249
  expect(@config.facet_fields.keys).to eq ["some_field_facet", "another_field_facet"]
250
250
  end
251
251
 
252
- it "should take wild-carded field names and dereference them to solr fields" do
252
+ it "takes wild-carded field names and dereference them to solr fields" do
253
253
  allow(@config).to receive_messages(luke_fields: {
254
254
  "some_field_facet" => {},
255
255
  "another_field_facet" => {},
@@ -261,17 +261,17 @@ describe "Blacklight::Configuration" do
261
261
  end
262
262
 
263
263
  describe "if/unless conditions with legacy show parameter" do
264
- it "should be hidden if the if condition is false" do
264
+ it "is hidden if the if condition is false" do
265
265
  expect(@config.add_facet_field("hidden", if: false).if).to eq false
266
266
  expect(@config.add_facet_field("hidden_with_legacy", if: false, show: true).if).to eq false
267
267
  end
268
268
 
269
- it "should be true if the if condition is true" do
269
+ it "is true if the if condition is true" do
270
270
  expect(@config.add_facet_field("hidden", if: true).if).to eq true
271
271
  expect(@config.add_facet_field("hidden_with_legacy", if: true, show: false).if).to eq true
272
272
  end
273
273
 
274
- it "should be true if the if condition is missing" do
274
+ it "is true if the if condition is missing" do
275
275
  expect(@config.add_facet_field("hidden", show: true).if).to eq true
276
276
  end
277
277
  end
@@ -304,11 +304,11 @@ describe "Blacklight::Configuration" do
304
304
  expect(@config.index_fields["title_display"].label).to eq "Title Display"
305
305
  end
306
306
 
307
- it "should raise on nil solr field name" do
307
+ it "raises on nil solr field name" do
308
308
  expect { @config.add_index_field(nil) }.to raise_error ArgumentError
309
309
  end
310
310
 
311
- it "should take wild-carded field names and dereference them to solr fields" do
311
+ it "takes wild-carded field names and dereference them to solr fields" do
312
312
  allow(@config).to receive_messages(luke_fields: {
313
313
  "some_field_display" => {},
314
314
  "another_field_display" => {},
@@ -319,7 +319,7 @@ describe "Blacklight::Configuration" do
319
319
  expect(@config.index_fields.keys).to eq ["some_field_display", "another_field_display"]
320
320
  end
321
321
 
322
- it "should query solr and get live values for match fields", integration: true do
322
+ it "queries solr and get live values for match fields", integration: true do
323
323
  @config.add_index_field match: /title.+display/
324
324
  expect(@config.index_fields.keys).to include "subtitle_display", "subtitle_vern_display", "title_display", "title_vern_display"
325
325
  end
@@ -353,11 +353,11 @@ describe "Blacklight::Configuration" do
353
353
  expect(@config.show_fields["my_custom_field"].label).to eq "My Custom Field"
354
354
  end
355
355
 
356
- it "should raise on nil solr field name" do
356
+ it "raises on nil solr field name" do
357
357
  expect { @config.add_show_field(nil) }.to raise_error ArgumentError
358
358
  end
359
359
 
360
- it "should take wild-carded field names and dereference them to solr fields" do
360
+ it "takes wild-carded field names and dereference them to solr fields" do
361
361
  allow(@config).to receive_messages(luke_fields: {
362
362
  "some_field_display" => {},
363
363
  "another_field_display" => {},
@@ -372,13 +372,13 @@ describe "Blacklight::Configuration" do
372
372
 
373
373
 
374
374
  describe "add_search_field" do
375
- it "should accept hash form" do
375
+ it "accepts hash form" do
376
376
  c = Blacklight::Configuration.new
377
377
  c.add_search_field(:key => "my_search_key")
378
378
  expect(c.search_fields["my_search_key"]).to_not be_nil
379
379
  end
380
380
 
381
- it "should accept two-arg hash form" do
381
+ it "accepts two-arg hash form" do
382
382
  c = Blacklight::Configuration.new
383
383
 
384
384
  c.add_search_field("my_search_type",
@@ -397,7 +397,7 @@ describe "Blacklight::Configuration" do
397
397
 
398
398
  end
399
399
 
400
- it "should accept block form" do
400
+ it "accepts block form" do
401
401
  c = Blacklight::Configuration.new
402
402
 
403
403
  c.add_search_field("some_field") do |field|
@@ -412,7 +412,7 @@ describe "Blacklight::Configuration" do
412
412
  expect(f.solr_local_parameters).to_not be_nil
413
413
  end
414
414
 
415
- it "should accept SearchField object" do
415
+ it "accepts SearchField object" do
416
416
  c = Blacklight::Configuration.new
417
417
 
418
418
  f = Blacklight::Configuration::SearchField.new( :foo => "bar")
@@ -422,7 +422,7 @@ describe "Blacklight::Configuration" do
422
422
  expect(c.search_fields["foo"]).to_not be_nil
423
423
  end
424
424
 
425
- it "should raise on nil key" do
425
+ it "raises on nil key" do
426
426
  expect {@config.add_search_field(nil, :foo => "bar")}.to raise_error ArgumentError
427
427
  end
428
428
 
@@ -433,43 +433,43 @@ describe "Blacklight::Configuration" do
433
433
  end
434
434
 
435
435
  describe "if/unless conditions with legacy include_in_simple_search" do
436
- it "should be hidden if the if condition is false" do
436
+ it "is hidden if the if condition is false" do
437
437
  expect(@config.add_search_field("hidden", if: false).if).to eq false
438
438
  expect(@config.add_search_field("hidden_with_legacy", if: false, include_in_simple_search: true).if).to eq false
439
439
  end
440
440
 
441
- it "should be true if the if condition is true" do
441
+ it "is true if the if condition is true" do
442
442
  expect(@config.add_search_field("hidden", if: true).if).to eq true
443
443
  expect(@config.add_search_field("hidden_with_legacy", if: true, include_in_simple_search: false).if).to eq true
444
444
  end
445
445
 
446
- it "should be true if the if condition is missing" do
446
+ it "is true if the if condition is missing" do
447
447
  expect(@config.add_search_field("hidden", include_in_simple_search: true).if).to eq true
448
448
  end
449
449
  end
450
450
  end
451
451
 
452
452
  describe "add_sort_field" do
453
- it "should take a hash" do
453
+ it "takes a hash" do
454
454
  c = Blacklight::Configuration.new
455
455
  c.add_sort_field(:key => "my_sort_key", :sort => "score desc")
456
456
  expect(c.sort_fields["my_sort_key"]).to_not be_nil
457
457
  end
458
458
 
459
- it "should take a two-arg form with a hash" do
459
+ it "takes a two-arg form with a hash" do
460
460
  @config.add_sort_field("score desc, pub_date_sort desc, title_sort asc", :label => "relevance")
461
461
 
462
462
 
463
463
  expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).to_not be_nil
464
464
  end
465
465
 
466
- it "should take a SortField object" do
466
+ it "takes a SortField object" do
467
467
  @config.add_sort_field(Blacklight::Configuration::SortField.new(:label => "relevance", :sort => "score desc, pub_date_sort desc, title_sort asc"
468
468
  ))
469
469
  expect(@config.sort_fields.values.find{|f| f.label == "relevance"}).to_not be_nil
470
470
  end
471
471
 
472
- it "should take block form" do
472
+ it "takes block form" do
473
473
  @config.add_sort_field do |field|
474
474
  field.label = "relevance"
475
475
  field.sort = "score desc, pub_date_sort desc, title_sort asc"
@@ -481,7 +481,7 @@ describe "Blacklight::Configuration" do
481
481
  end
482
482
 
483
483
  describe "#default_search_field" do
484
- it "should use the field with a :default key" do
484
+ it "uses the field with a :default key" do
485
485
  @config.add_search_field('search_field_1')
486
486
  @config.add_search_field('search_field_2', :default => true)
487
487
 
@@ -490,7 +490,7 @@ describe "Blacklight::Configuration" do
490
490
  end
491
491
 
492
492
  describe "#facet_paginator_class" do
493
- it "should default to Blacklight::Solr::FacetPaginator" do
493
+ it "defaults to Blacklight::Solr::FacetPaginator" do
494
494
  expect(@config.facet_paginator_class).to eq Blacklight::Solr::FacetPaginator
495
495
  end
496
496
  end