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
@@ -11,50 +11,50 @@ describe Blacklight::Document do
11
11
 
12
12
  describe "#has?" do
13
13
  context "without value constraints" do
14
- it "should have the field if the field is in the data" do
14
+ it "has the field if the field is in the data" do
15
15
  data[:x] = true
16
16
  expect(subject).to have_field(:x)
17
17
  end
18
18
 
19
- it "should not have the field if the field is not in the data" do
19
+ it "does not have the field if the field is not in the data" do
20
20
  expect(subject).not_to have_field(:x)
21
21
  end
22
22
  end
23
23
 
24
24
  context "with regular value constraints" do
25
- it "should have the field if the data has that value" do
25
+ it "has the field if the data has that value" do
26
26
  data[:x] = true
27
27
  expect(subject).to have_field(:x, true)
28
28
  end
29
29
 
30
- it "should not have the field if the data does not have that value" do
30
+ it "does not have the field if the data does not have that value" do
31
31
  data[:x] = false
32
32
  expect(subject).not_to have_field(:x, true)
33
33
  end
34
34
 
35
- it "should allow multiple value constraints" do
35
+ it "allows multiple value constraints" do
36
36
  data[:x] = false
37
37
  expect(subject).to have_field(:x, true, false)
38
38
  end
39
39
 
40
- it "should support multivalued fields" do
40
+ it "supports multivalued fields" do
41
41
  data[:x] = ["a", "b", "c"]
42
42
  expect(subject).to have_field(:x, "a")
43
43
  end
44
44
 
45
- it "should support multivalued fields with an array of value constraints" do
45
+ it "supports multivalued fields with an array of value constraints" do
46
46
  data[:x] = ["a", "b", "c"]
47
47
  expect(subject).to have_field(:x, "a", "d")
48
48
  end
49
49
  end
50
50
 
51
51
  context "with regexp value constraints" do
52
- it "should check if the data matches the constraint" do
52
+ it "checks if the data matches the constraint" do
53
53
  data[:x] = "the quick brown fox"
54
54
  expect(subject).to have_field(:x, /fox/)
55
55
  end
56
56
 
57
- it "should support multivalued fields" do
57
+ it "supports multivalued fields" do
58
58
  data[:x] = ["the quick brown fox", "and the lazy dog"]
59
59
  expect(subject).to have_field(:x, /fox/)
60
60
  end
@@ -84,7 +84,7 @@ describe Blacklight::Document do
84
84
  allow(MockDocument).to receive(:repository).and_return(double(find: MockResponse.new([{id: 1}], {})))
85
85
  end
86
86
 
87
- it "should have a globalid" do
87
+ it "has a globalid" do
88
88
  expect(MockDocument.find(1).to_global_id).to be_a GlobalID
89
89
  end
90
90
  end
@@ -21,7 +21,7 @@ describe Blacklight::FacetPaginator do
21
21
  its(:current_page) { should eq 1 }
22
22
  its(:prev_page) { should be_nil }
23
23
  its(:next_page) { should eq 2 }
24
- it 'should limit items to limit, if limit is smaller than items.length' do
24
+ it 'limits items to limit, if limit is smaller than items.length' do
25
25
  expect(subject.items.size).to eq 6
26
26
  end
27
27
  end
@@ -33,7 +33,7 @@ describe Blacklight::FacetPaginator do
33
33
  its(:current_page) { should eq 2 }
34
34
  its(:prev_page) { should eq 1 }
35
35
  its(:next_page) { should be_nil }
36
- it 'should return all items when limit is greater than items.length' do
36
+ it 'returns all items when limit is greater than items.length' do
37
37
  expect(subject.items.size).to eq 1
38
38
  end
39
39
  end
@@ -45,7 +45,7 @@ describe Blacklight::FacetPaginator do
45
45
  its(:current_page) { should eq 2 }
46
46
  its(:prev_page) { should eq 1 }
47
47
  its(:next_page) { should eq 3 }
48
- it 'should limit items to limit, if limit is smaller than items.length' do
48
+ it 'limits items to limit, if limit is smaller than items.length' do
49
49
  expect(subject.items.size).to eq 6
50
50
  end
51
51
  end
@@ -61,7 +61,7 @@ describe Blacklight::FacetPaginator do
61
61
  let(:page_key) { described_class.request_keys[:page] }
62
62
  subject { described_class.new([], offset: 100, limit: limit, sort: 'index') }
63
63
 
64
- it 'should know a manually set sort, and produce proper sort url' do
64
+ it 'knows a manually set sort, and produce proper sort url' do
65
65
  expect(subject.sort).to eq 'index'
66
66
 
67
67
  click_params = subject.params_for_resort_url('count', {}.with_indifferent_access)
@@ -105,7 +105,7 @@ describe Blacklight::FacetPaginator do
105
105
 
106
106
  describe "#as_json" do
107
107
  subject { described_class.new([f1], offset: 0, limit: nil).as_json }
108
- it "should be well structured" do
108
+ it "is well structured" do
109
109
  expect(subject).to eq("items" => [{"hits"=>"792", "value"=>"Book"}], "limit" => nil,
110
110
  "offset" => 0, "sort" => nil)
111
111
  end
@@ -28,13 +28,13 @@ describe Blacklight::SearchBuilder do
28
28
  end
29
29
 
30
30
  describe "#with" do
31
- it "should set the blacklight params" do
31
+ it "sets the blacklight params" do
32
32
  params = {}
33
33
  subject.with(params)
34
34
  expect(subject.blacklight_params).to eq params
35
35
  end
36
36
 
37
- it "should dup the params" do
37
+ it "dups the params" do
38
38
  params = {}
39
39
  subject.with(params).where('asdf')
40
40
  expect(subject.blacklight_params).not_to eq params
@@ -45,7 +45,7 @@ describe Blacklight::SearchBuilder do
45
45
 
46
46
  describe "#processor_chain" do
47
47
  let(:processor_chain) { [:a, :b, :c] }
48
- it "should be mutable" do
48
+ it "is mutable" do
49
49
  subject.processor_chain.insert(-1, :d)
50
50
  expect(subject.processor_chain).to match_array [:a, :b, :c, :d]
51
51
  end
@@ -53,7 +53,7 @@ describe Blacklight::SearchBuilder do
53
53
 
54
54
  describe "#append" do
55
55
  let(:processor_chain) { [:a, :b, :c] }
56
- it "should provide a new search builder with the processor chain" do
56
+ it "provides a new search builder with the processor chain" do
57
57
  builder = subject.append(:d, :e)
58
58
  expect(subject.processor_chain).to eq processor_chain
59
59
  expect(builder.processor_chain).not_to eq subject.processor_chain
@@ -73,7 +73,7 @@ describe Blacklight::SearchBuilder do
73
73
  end
74
74
 
75
75
  describe "#to_hash" do
76
- it "should update if data is changed" do
76
+ it "updates if data is changed" do
77
77
  subject.merge(q: 'xyz')
78
78
  expect(subject.to_hash).to include q: 'xyz'
79
79
  subject.merge(q: 'abc')
@@ -88,7 +88,7 @@ describe Blacklight::SearchBuilder do
88
88
  req_params.replace subject.blacklight_params
89
89
  end
90
90
  end
91
- it "should overwrite the processed parameters" do
91
+ it "overwrites the processed parameters" do
92
92
  actual = subject.with(q: 'abc').merge(q: 'xyz')
93
93
  expect(actual[:q]).to eq 'xyz'
94
94
  end
@@ -102,12 +102,12 @@ describe Blacklight::SearchBuilder do
102
102
  end
103
103
  end
104
104
 
105
- it "should provide default values for parameters" do
105
+ it "provides default values for parameters" do
106
106
  actual = subject.reverse_merge(a: 1)
107
107
  expect(actual[:a]).to eq 1
108
108
  end
109
109
 
110
- it "should not overwrite the processed parameters" do
110
+ it "does not overwrite the processed parameters" do
111
111
  actual = subject.with(q: 'abc').reverse_merge(q: 'xyz')
112
112
  expect(actual[:q]).to eq 'abc'
113
113
  end
@@ -116,7 +116,7 @@ describe Blacklight::SearchBuilder do
116
116
  describe "#processed_parameters" do
117
117
  let(:processor_chain) { [:step_1] }
118
118
 
119
- it "should try to run the processor method on the search builder" do
119
+ it "tries to run the processor method on the search builder" do
120
120
  allow(subject).to receive(:step_1) do |req_params|
121
121
  req_params[:step_1] = 'builder'
122
122
  end
@@ -127,130 +127,130 @@ describe Blacklight::SearchBuilder do
127
127
  end
128
128
 
129
129
  describe "#blacklight_config" do
130
- it "should get the blacklight_config from the scope" do
130
+ it "gets the blacklight_config from the scope" do
131
131
  expect(subject.blacklight_config).to eq scope.blacklight_config
132
132
  end
133
133
  end
134
134
 
135
135
  describe "#page" do
136
- it "should be the current user parameter page number" do
136
+ it "is the current user parameter page number" do
137
137
  expect(subject.with(page: 2).send(:page)).to eq 2
138
138
  end
139
139
 
140
- it "should be page 1 if not page number given" do
140
+ it "is page 1 if not page number given" do
141
141
  expect(subject.send(:page)).to eq 1
142
142
  end
143
143
 
144
- it "should coerce parameters to integers" do
144
+ it "coerces parameters to integers" do
145
145
  expect(subject.with(page: '2b').send(:page)).to eq 2
146
146
  end
147
147
  end
148
148
 
149
149
  describe "#rows" do
150
150
 
151
- it "should be nil if no value is set" do
151
+ it "is nil if no value is set" do
152
152
  blacklight_config.default_per_page = nil
153
153
  blacklight_config.per_page = []
154
154
  expect(subject.rows).to be_nil
155
155
  end
156
156
 
157
- it "should set the number of rows" do
157
+ it "sets the number of rows" do
158
158
  expect(subject.rows(17).rows).to eq 17
159
159
  end
160
160
 
161
- it "should be the per_page parameter" do
161
+ it "is the per_page parameter" do
162
162
  expect(subject.with(per_page: 5).rows).to eq 5
163
163
  end
164
164
 
165
- it "should support the legacy 'rows' parameter" do
165
+ it "supports the legacy 'rows' parameter" do
166
166
  expect(subject.with(rows: 10).rows).to eq 10
167
167
  end
168
168
 
169
- it "should be set to the configured default" do
169
+ it "is set to the configured default" do
170
170
  blacklight_config.default_per_page = 42
171
171
  expect(subject.rows).to eq 42
172
172
  end
173
173
 
174
- it "should limit the number of rows to the configured maximum" do
174
+ it "limits the number of rows to the configured maximum" do
175
175
  blacklight_config.max_per_page = 1000
176
176
  expect(subject.rows(1001).rows).to eq 1000
177
177
  end
178
178
  end
179
179
 
180
180
  describe "#sort" do
181
- it "should pass through the sort parameter" do
181
+ it "passes through the sort parameter" do
182
182
  expect(subject.with(sort: 'x').send(:sort)).to eq 'x'
183
183
  end
184
184
 
185
- it "should use the default if no sort parameter is given" do
185
+ it "uses the default if no sort parameter is given" do
186
186
  blacklight_config.default_sort_field = double(sort: 'x desc')
187
187
  expect(subject.send(:sort)).to eq 'x desc'
188
188
  end
189
189
 
190
- it "should use the requested sort field" do
190
+ it "uses the requested sort field" do
191
191
  blacklight_config.add_sort_field 'x', sort: 'x asc'
192
192
  expect(subject.with(sort: 'x').send(:sort)).to eq 'x asc'
193
193
  end
194
194
  end
195
195
 
196
196
  describe "#facet" do
197
- it "should be nil if no value is set" do
197
+ it "is nil if no value is set" do
198
198
  expect(subject.facet).to be_nil
199
199
  end
200
200
 
201
- it "should set facet value" do
201
+ it "sets facet value" do
202
202
  expect(subject.facet('format').facet).to eq 'format'
203
203
  end
204
204
  end
205
205
 
206
206
  describe "#search_field" do
207
- it "should use the requested search field" do
207
+ it "uses the requested search field" do
208
208
  blacklight_config.add_search_field 'x'
209
209
  expect(subject.with(search_field: 'x').send(:search_field)).to eq blacklight_config.search_fields['x']
210
210
  end
211
211
  end
212
212
 
213
213
  describe "#params_changed?" do
214
- it "should be false" do
214
+ it "is false" do
215
215
  expect(subject.send(:params_changed?)).to eq false
216
216
  end
217
217
 
218
- it "should be marked as changed when with() changes" do
218
+ it "is marked as changed when with() changes" do
219
219
  subject.with(a: 1)
220
220
  expect(subject.send(:params_changed?)).to eq true
221
221
  end
222
222
 
223
- it "should be marked as changed when where() changes" do
223
+ it "is marked as changed when where() changes" do
224
224
  subject.where(a: 1)
225
225
  expect(subject.send(:params_changed?)).to eq true
226
226
  end
227
227
 
228
- it "should be marked as changed when the processor chain changes" do
228
+ it "is marked as changed when the processor chain changes" do
229
229
  subject.append(:a)
230
230
  expect(subject.send(:params_changed?)).to eq true
231
231
  end
232
232
 
233
- it "should be marked as changed when merged parameters are added" do
233
+ it "is marked as changed when merged parameters are added" do
234
234
  subject.merge(a: 1)
235
235
  expect(subject.send(:params_changed?)).to eq true
236
236
  end
237
237
 
238
- it "should be marked as changed when reverse merged parameters are added" do
238
+ it "is marked as changed when reverse merged parameters are added" do
239
239
  subject.merge(a: 1)
240
240
  expect(subject.send(:params_changed?)).to eq true
241
241
  end
242
242
 
243
- it "should be marked as changed when pagination changes" do
243
+ it "is marked as changed when pagination changes" do
244
244
  subject.page(1)
245
245
  expect(subject.send(:params_changed?)).to eq true
246
246
  end
247
247
 
248
- it "should be marked as changed when rows changes" do
248
+ it "is marked as changed when rows changes" do
249
249
  subject.rows(1)
250
250
  expect(subject.send(:params_changed?)).to eq true
251
251
  end
252
252
 
253
- it "should be marked as changed when start offset changes" do
253
+ it "is marked as changed when start offset changes" do
254
254
  subject.start(1)
255
255
  expect(subject.send(:params_changed?)).to eq true
256
256
  end
@@ -16,7 +16,7 @@ describe "Blacklight::User" do
16
16
  subject.bookmarks << mock_bookmark(3)
17
17
  end
18
18
 
19
- it "should return all the bookmarks that match the given documents" do
19
+ it "returns all the bookmarks that match the given documents" do
20
20
  bookmarks = subject.bookmarks_for_documents([SolrDocument.new(id: 1), SolrDocument.new(id: 2)])
21
21
  expect(bookmarks).to have(2).items
22
22
  expect(bookmarks.first.document_id).to eq "1"
@@ -29,11 +29,11 @@ describe "Blacklight::User" do
29
29
  subject.bookmarks << mock_bookmark(1)
30
30
  end
31
31
 
32
- it "should be true if the document is bookmarked" do
32
+ it "is true if the document is bookmarked" do
33
33
  expect(subject).to be_document_is_bookmarked(SolrDocument.new(id: 1))
34
34
  end
35
35
 
36
- it "should be false if the document is not bookmarked" do
36
+ it "is false if the document is not bookmarked" do
37
37
  expect(subject).to_not be_document_is_bookmarked(SolrDocument.new(id: 2))
38
38
  end
39
39
  end
@@ -43,7 +43,7 @@ describe "Blacklight::User" do
43
43
  subject.bookmarks << mock_bookmark(1)
44
44
  end
45
45
 
46
- it "should return the bookmark for that document id" do
46
+ it "returns the bookmark for that document id" do
47
47
  expect(subject.existing_bookmark_for(SolrDocument.new(id: 1))).to eq subject.bookmarks.first
48
48
  end
49
49
  end
@@ -9,27 +9,27 @@ describe Bookmark do
9
9
  b
10
10
  end
11
11
 
12
- it "should be valid" do
12
+ it "is valid" do
13
13
  expect(subject).to be_valid
14
14
  end
15
15
 
16
- it "should belong to user" do
16
+ it "belongs to user" do
17
17
  expect(Bookmark.reflect_on_association(:user)).not_to be_nil
18
18
  end
19
19
 
20
- it "should be valid after saving" do
20
+ it "is valid after saving" do
21
21
  subject.save
22
22
  expect(subject).to be_valid
23
23
  end
24
24
 
25
25
  describe "#document_type" do
26
- it "should be the class of the solr document" do
26
+ it "is the class of the solr document" do
27
27
  expect(subject.document_type).to eq SolrDocument
28
28
  end
29
29
  end
30
30
 
31
31
  describe "#document" do
32
- it "should be a SolrDocument with just an id field" do
32
+ it "is a SolrDocument with just an id field" do
33
33
  expect(subject.document).to be_a_kind_of SolrDocument
34
34
  expect(subject.document.id).to eq 'u001'
35
35
  end
@@ -14,24 +14,24 @@ describe RecordMailer do
14
14
  details = {:to => 'test@test.com', :message => "This is my message"}
15
15
  @email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
16
16
  end
17
- it "should receive the TO paramater and send the email to that address" do
17
+ it "receives the TO paramater and send the email to that address" do
18
18
  expect(@email.to).to include 'test@test.com'
19
19
  end
20
- it "should start the subject w/ Item Record:" do
20
+ it "starts the subject w/ Item Record:" do
21
21
  expect(@email.subject).to match /^Item Record:/
22
22
  end
23
- it "should put the title of the item in the subject" do
23
+ it "puts the title of the item in the subject" do
24
24
  expect(@email.subject).to match /The horn/
25
25
  end
26
- it "should have the correct from address (w/o the port number)" do
26
+ it "has the correct from address (w/o the port number)" do
27
27
  expect(@email.from).to include "no-reply@projectblacklight.org"
28
28
  end
29
- it "should print out the correct body" do
29
+ it "prints out the correct body" do
30
30
  expect(@email.body).to match /Title: The horn/
31
31
  expect(@email.body).to match /Author: Janetzky, Kurt/
32
32
  expect(@email.body).to match /projectblacklight.org/
33
33
  end
34
- it "should use https URLs when protocol is set" do
34
+ it "uses https URLs when protocol is set" do
35
35
  details = {:to => 'test@test.com', :message => "This is my message"}
36
36
  @https_email = RecordMailer.email_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
37
37
  expect(@https_email.body).to match %r|https://projectblacklight.org/|
@@ -43,21 +43,21 @@ describe RecordMailer do
43
43
  details = {:to => '5555555555@txt.att.net'}
44
44
  @sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org:3000'})
45
45
  end
46
- it "should create the correct TO address for the SMS email" do
46
+ it "creates the correct TO address for the SMS email" do
47
47
  expect(@sms.to).to include '5555555555@txt.att.net'
48
48
  end
49
- it "should not have a subject" do
49
+ it "does not have a subject" do
50
50
  expect(@sms.subject).to be_blank
51
51
  end
52
- it "should have the correct from address (w/o the port number)" do
52
+ it "has the correct from address (w/o the port number)" do
53
53
  expect(@sms.from).to include "no-reply@projectblacklight.org"
54
54
  end
55
- it "should print out the correct body" do
55
+ it "prints out the correct body" do
56
56
  expect(@sms.body).to match /The horn/
57
57
  expect(@sms.body).to match /by Janetzky, Kurt/
58
58
  expect(@sms.body).to match /projectblacklight.org:3000/
59
59
  end
60
- it "should use https URL when protocol is set" do
60
+ it "uses https URL when protocol is set" do
61
61
  details = {:to => '5555555555@txt.att.net'}
62
62
  @https_sms = RecordMailer.sms_record(@documents,details,{:host =>'projectblacklight.org', :protocol => 'https'})
63
63
  expect(@https_sms.body).to match %r|https://projectblacklight.org/|