blacklight 8.0.0.beta4 → 8.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +3 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.esm.js +5 -5
  5. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  6. data/app/assets/javascripts/blacklight/blacklight.js +5 -5
  7. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  8. data/app/components/blacklight/document_component.rb +26 -19
  9. data/app/components/blacklight/document_metadata_component.html.erb +4 -2
  10. data/app/components/blacklight/document_metadata_component.rb +8 -2
  11. data/app/components/blacklight/metadata_field_layout_component.rb +7 -4
  12. data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +17 -0
  13. data/app/components/blacklight/response/sort_component.rb +1 -1
  14. data/app/components/blacklight/response/spellcheck_component.rb +1 -1
  15. data/app/components/blacklight/response/view_type_button_component.rb +1 -1
  16. data/app/components/blacklight/response/view_type_component.rb +1 -1
  17. data/app/components/blacklight/search_context/server_applied_params_component.html.erb +4 -0
  18. data/app/components/blacklight/search_context/server_applied_params_component.rb +13 -0
  19. data/app/components/blacklight/{search_context_component.html.erb → search_context/server_item_pagination_component.html.erb} +0 -0
  20. data/app/components/blacklight/search_context/server_item_pagination_component.rb +71 -0
  21. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  22. data/app/components/blacklight/system/flash_message_component.rb +1 -1
  23. data/app/components/blacklight/system/modal_component.rb +1 -1
  24. data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
  25. data/app/controllers/concerns/blacklight/search_context.rb +46 -6
  26. data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -96
  27. data/app/helpers/blacklight/catalog_helper_behavior.rb +27 -54
  28. data/app/helpers/blacklight/component_helper_behavior.rb +0 -11
  29. data/app/helpers/blacklight/document_helper_behavior.rb +76 -0
  30. data/app/helpers/blacklight/layout_helper_behavior.rb +59 -0
  31. data/app/helpers/blacklight/url_helper_behavior.rb +11 -3
  32. data/app/javascript/blacklight/modal.js +5 -5
  33. data/app/models/record_mailer.rb +19 -15
  34. data/app/presenters/blacklight/document_presenter.rb +13 -11
  35. data/app/presenters/blacklight/index_presenter.rb +1 -1
  36. data/app/presenters/blacklight/rendering/abstract_step.rb +4 -0
  37. data/app/presenters/blacklight/rendering/join.rb +7 -1
  38. data/app/presenters/blacklight/rendering/link_to_facet.rb +1 -1
  39. data/app/presenters/blacklight/rendering/microdata.rb +1 -1
  40. data/app/services/blacklight/search_service.rb +2 -1
  41. data/app/views/catalog/_document.atom.builder +1 -1
  42. data/app/views/catalog/_document.html.erb +2 -7
  43. data/app/views/catalog/_document_list.html.erb +2 -1
  44. data/app/views/catalog/_show_main_content.html.erb +3 -9
  45. data/app/views/catalog/index.html.erb +3 -0
  46. data/app/views/catalog/show.html.erb +1 -6
  47. data/app/views/record_mailer/email_record.text.erb +4 -3
  48. data/app/views/record_mailer/sms_record.text.erb +4 -4
  49. data/config/locales/blacklight.ar.yml +0 -6
  50. data/config/locales/blacklight.ca.yml +0 -6
  51. data/config/locales/blacklight.de.yml +0 -6
  52. data/config/locales/blacklight.en.yml +0 -6
  53. data/config/locales/blacklight.es.yml +0 -6
  54. data/config/locales/blacklight.fr.yml +0 -6
  55. data/config/locales/blacklight.hu.yml +0 -6
  56. data/config/locales/blacklight.it.yml +0 -6
  57. data/config/locales/blacklight.nl.yml +0 -6
  58. data/config/locales/blacklight.pt-BR.yml +0 -6
  59. data/config/locales/blacklight.sq.yml +0 -6
  60. data/config/locales/blacklight.zh.yml +0 -6
  61. data/lib/blacklight/configuration/session_tracking_config.rb +45 -0
  62. data/lib/blacklight/configuration.rb +8 -4
  63. data/lib/blacklight/routes/searchable.rb +1 -0
  64. data/lib/generators/blacklight/templates/solr_document.rb +0 -6
  65. data/package.json +1 -1
  66. data/spec/components/blacklight/document_component_spec.rb +9 -4
  67. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +29 -0
  68. data/spec/components/blacklight/{search_context_component_spec.rb → search_context/server_item_pagination_component_spec.rb} +15 -4
  69. data/spec/controllers/bookmarks_controller_spec.rb +1 -1
  70. data/spec/controllers/catalog_controller_spec.rb +17 -5
  71. data/spec/features/component_template_override_spec.rb +8 -0
  72. data/spec/features/modal_spec.rb +12 -0
  73. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +1 -1
  74. data/spec/helpers/blacklight_helper_spec.rb +0 -56
  75. data/spec/helpers/catalog_helper_spec.rb +56 -0
  76. data/spec/lib/blacklight/configuration/session_tracking_config_spec.rb +38 -0
  77. data/spec/models/record_mailer_spec.rb +36 -23
  78. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -0
  79. data/spec/presenters/blacklight/field_presenter_spec.rb +2 -2
  80. data/spec/presenters/blacklight/index_presenter_spec.rb +1 -0
  81. data/spec/presenters/blacklight/show_presenter_spec.rb +1 -0
  82. data/spec/presenters/pipeline_spec.rb +13 -2
  83. data/spec/routing/catalog_routing_spec.rb +4 -0
  84. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -0
  85. data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
  86. data/spec/views/catalog/_document_list.html.erb_spec.rb +7 -2
  87. metadata +19 -12
  88. data/app/components/blacklight/search_context_component.rb +0 -68
  89. data/app/models/concerns/blacklight/document/email.rb +0 -27
  90. data/app/models/concerns/blacklight/document/sms.rb +0 -25
  91. data/spec/models/blacklight/document/email_spec.rb +0 -57
  92. data/spec/models/blacklight/document/sms_spec.rb +0 -58
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.beta4
4
+ version: 8.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2023-01-31 00:00:00.000000000 Z
20
+ date: 2023-02-02 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -459,6 +459,7 @@ files:
459
459
  - app/components/blacklight/metadata_field_component.rb
460
460
  - app/components/blacklight/metadata_field_layout_component.html.erb
461
461
  - app/components/blacklight/metadata_field_layout_component.rb
462
+ - app/components/blacklight/metadata_field_plain_text_layout_component.rb
462
463
  - app/components/blacklight/response/facet_group_component.html.erb
463
464
  - app/components/blacklight/response/facet_group_component.rb
464
465
  - app/components/blacklight/response/pagination_component.html.erb
@@ -476,8 +477,10 @@ files:
476
477
  - app/components/blacklight/search_bar_component.html.erb
477
478
  - app/components/blacklight/search_bar_component.rb
478
479
  - app/components/blacklight/search_button_component.rb
479
- - app/components/blacklight/search_context_component.html.erb
480
- - app/components/blacklight/search_context_component.rb
480
+ - app/components/blacklight/search_context/server_applied_params_component.html.erb
481
+ - app/components/blacklight/search_context/server_applied_params_component.rb
482
+ - app/components/blacklight/search_context/server_item_pagination_component.html.erb
483
+ - app/components/blacklight/search_context/server_item_pagination_component.rb
481
484
  - app/components/blacklight/search_header_component.html.erb
482
485
  - app/components/blacklight/search_header_component.rb
483
486
  - app/components/blacklight/search_history_constraint_layout_component.rb
@@ -506,6 +509,7 @@ files:
506
509
  - app/helpers/blacklight/catalog_helper_behavior.rb
507
510
  - app/helpers/blacklight/component_helper_behavior.rb
508
511
  - app/helpers/blacklight/configuration_helper_behavior.rb
512
+ - app/helpers/blacklight/document_helper_behavior.rb
509
513
  - app/helpers/blacklight/facets_helper_behavior.rb
510
514
  - app/helpers/blacklight/icon_helper_behavior.rb
511
515
  - app/helpers/blacklight/layout_helper_behavior.rb
@@ -531,12 +535,10 @@ files:
531
535
  - app/models/concerns/blacklight/document/attributes.rb
532
536
  - app/models/concerns/blacklight/document/cache_key.rb
533
537
  - app/models/concerns/blacklight/document/dublin_core.rb
534
- - app/models/concerns/blacklight/document/email.rb
535
538
  - app/models/concerns/blacklight/document/export.rb
536
539
  - app/models/concerns/blacklight/document/extensions.rb
537
540
  - app/models/concerns/blacklight/document/schema_org.rb
538
541
  - app/models/concerns/blacklight/document/semantic_fields.rb
539
- - app/models/concerns/blacklight/document/sms.rb
540
542
  - app/models/concerns/blacklight/suggest/response.rb
541
543
  - app/models/concerns/blacklight/user.rb
542
544
  - app/models/record_mailer.rb
@@ -687,6 +689,7 @@ files:
687
689
  - lib/blacklight/configuration/null_display_field.rb
688
690
  - lib/blacklight/configuration/null_field.rb
689
691
  - lib/blacklight/configuration/search_field.rb
692
+ - lib/blacklight/configuration/session_tracking_config.rb
690
693
  - lib/blacklight/configuration/show_field.rb
691
694
  - lib/blacklight/configuration/sort_field.rb
692
695
  - lib/blacklight/configuration/tool_config.rb
@@ -777,7 +780,8 @@ files:
777
780
  - spec/components/blacklight/response/spellcheck_component_spec.rb
778
781
  - spec/components/blacklight/response/view_type_component_spec.rb
779
782
  - spec/components/blacklight/search_bar_component_spec.rb
780
- - spec/components/blacklight/search_context_component_spec.rb
783
+ - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
784
+ - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
781
785
  - spec/components/blacklight/start_over_button_component_spec.rb
782
786
  - spec/components/blacklight/system/flash_message_component_spec.rb
783
787
  - spec/controllers/alternate_controller_spec.rb
@@ -792,9 +796,11 @@ files:
792
796
  - spec/features/autocomplete_spec.rb
793
797
  - spec/features/axe_spec.rb
794
798
  - spec/features/bookmarks_spec.rb
799
+ - spec/features/component_template_override_spec.rb
795
800
  - spec/features/did_you_mean_spec.rb
796
801
  - spec/features/facet_missing_spec.rb
797
802
  - spec/features/facets_spec.rb
803
+ - spec/features/modal_spec.rb
798
804
  - spec/features/record_view_spec.rb
799
805
  - spec/features/search_context_spec.rb
800
806
  - spec/features/search_crawler_spec.rb
@@ -820,6 +826,7 @@ files:
820
826
  - spec/lib/blacklight/component_spec.rb
821
827
  - spec/lib/blacklight/configuration/facet_field_spec.rb
822
828
  - spec/lib/blacklight/configuration/field_spec.rb
829
+ - spec/lib/blacklight/configuration/session_tracking_config_spec.rb
823
830
  - spec/lib/blacklight/configuration/view_config_spec.rb
824
831
  - spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
825
832
  - spec/lib/blacklight/open_struct_with_hash_access_spec.rb
@@ -835,8 +842,6 @@ files:
835
842
  - spec/models/blacklight/document/active_model_shim_spec.rb
836
843
  - spec/models/blacklight/document/cache_key_spec.rb
837
844
  - spec/models/blacklight/document/dublin_core_spec.rb
838
- - spec/models/blacklight/document/email_spec.rb
839
- - spec/models/blacklight/document/sms_spec.rb
840
845
  - spec/models/blacklight/document_spec.rb
841
846
  - spec/models/blacklight/facet_paginator_spec.rb
842
847
  - spec/models/blacklight/icon_spec.rb
@@ -948,7 +953,8 @@ test_files:
948
953
  - spec/components/blacklight/response/spellcheck_component_spec.rb
949
954
  - spec/components/blacklight/response/view_type_component_spec.rb
950
955
  - spec/components/blacklight/search_bar_component_spec.rb
951
- - spec/components/blacklight/search_context_component_spec.rb
956
+ - spec/components/blacklight/search_context/server_applied_params_component_spec.rb
957
+ - spec/components/blacklight/search_context/server_item_pagination_component_spec.rb
952
958
  - spec/components/blacklight/start_over_button_component_spec.rb
953
959
  - spec/components/blacklight/system/flash_message_component_spec.rb
954
960
  - spec/controllers/alternate_controller_spec.rb
@@ -963,9 +969,11 @@ test_files:
963
969
  - spec/features/autocomplete_spec.rb
964
970
  - spec/features/axe_spec.rb
965
971
  - spec/features/bookmarks_spec.rb
972
+ - spec/features/component_template_override_spec.rb
966
973
  - spec/features/did_you_mean_spec.rb
967
974
  - spec/features/facet_missing_spec.rb
968
975
  - spec/features/facets_spec.rb
976
+ - spec/features/modal_spec.rb
969
977
  - spec/features/record_view_spec.rb
970
978
  - spec/features/search_context_spec.rb
971
979
  - spec/features/search_crawler_spec.rb
@@ -991,6 +999,7 @@ test_files:
991
999
  - spec/lib/blacklight/component_spec.rb
992
1000
  - spec/lib/blacklight/configuration/facet_field_spec.rb
993
1001
  - spec/lib/blacklight/configuration/field_spec.rb
1002
+ - spec/lib/blacklight/configuration/session_tracking_config_spec.rb
994
1003
  - spec/lib/blacklight/configuration/view_config_spec.rb
995
1004
  - spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb
996
1005
  - spec/lib/blacklight/open_struct_with_hash_access_spec.rb
@@ -1006,8 +1015,6 @@ test_files:
1006
1015
  - spec/models/blacklight/document/active_model_shim_spec.rb
1007
1016
  - spec/models/blacklight/document/cache_key_spec.rb
1008
1017
  - spec/models/blacklight/document/dublin_core_spec.rb
1009
- - spec/models/blacklight/document/email_spec.rb
1010
- - spec/models/blacklight/document/sms_spec.rb
1011
1018
  - spec/models/blacklight/document_spec.rb
1012
1019
  - spec/models/blacklight/facet_paginator_spec.rb
1013
1020
  - spec/models/blacklight/icon_spec.rb
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Blacklight
4
- class SearchContextComponent < Blacklight::Component
5
- with_collection_parameter :search_context
6
-
7
- def initialize(search_context:, search_session:)
8
- @search_context = search_context
9
- @search_session = search_session
10
- end
11
-
12
- def render?
13
- @search_context.present? && (@search_context[:prev] || @search_context[:next])
14
- end
15
-
16
- ##
17
- # Displays "showing X of Y items" message.
18
- #
19
- # @return [String]
20
- def item_page_entry_info
21
- t('blacklight.search.entry_pagination_info.other', current: number_with_delimiter(count),
22
- total: number_with_delimiter(total),
23
- count: total).html_safe
24
- end
25
-
26
- def link_to_previous_document(previous_document = nil, classes: 'previous', **link_opts)
27
- previous_document ||= @search_context[:prev]
28
- link_opts = session_tracking_params(previous_document, count - 1, per_page: per_page, search_id: search_id).merge(class: classes, rel: 'prev').merge(link_opts)
29
- link_to_unless previous_document.nil?, raw(t('views.pagination.previous')), url_for_document(previous_document), link_opts do
30
- tag.span raw(t('views.pagination.previous')), class: 'previous'
31
- end
32
- end
33
-
34
- def link_to_next_document(next_document = nil, classes: 'next', **link_opts)
35
- next_document ||= @search_context[:next]
36
- link_opts = session_tracking_params(next_document, count + 1, per_page: per_page, search_id: search_id).merge(class: classes, rel: 'next').merge(link_opts)
37
- link_to_unless next_document.nil?, raw(t('views.pagination.next')), url_for_document(next_document), link_opts do
38
- tag.span raw(t('views.pagination.next')), class: 'next'
39
- end
40
- end
41
-
42
- private
43
-
44
- def count
45
- @search_session['counter'].to_i
46
- end
47
-
48
- def per_page
49
- @search_session['per_page']
50
- end
51
-
52
- def total
53
- @search_session['total'].to_i
54
- end
55
-
56
- def search_id
57
- controller.current_search_session&.id
58
- end
59
-
60
- def session_tracking_params(...)
61
- helpers.session_tracking_params(...)
62
- end
63
-
64
- def url_for_document(...)
65
- helpers.search_state.url_for_document(...)
66
- end
67
- end
68
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides the body of an email export based on the document's semantic values
4
- module Blacklight::Document::Email
5
- # Return a text string that will be the body of the email
6
- def to_email_text(config = nil)
7
- body = []
8
-
9
- if config
10
- body = config.email_fields.map do |name, field|
11
- values = [self[name]].flatten
12
- "#{field.label} #{values.join(' ')}" if self[name].present?
13
- end
14
- end
15
-
16
- # Use to_semantic_values for backwards compatibility
17
- if body.empty?
18
- semantics = to_semantic_values
19
- body << I18n.t('blacklight.email.text.title', value: semantics[:title].join(" ")) if semantics[:title].present?
20
- body << I18n.t('blacklight.email.text.author', value: semantics[:author].join(" ")) if semantics[:author].present?
21
- body << I18n.t('blacklight.email.text.format', value: semantics[:format].join(" ")) if semantics[:format].present?
22
- body << I18n.t('blacklight.email.text.language', value: semantics[:language].join(" ")) if semantics[:language].present?
23
- end
24
-
25
- return body.join("\n") unless body.empty?
26
- end
27
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This module provides the body of an email export based on the document's semantic values
4
- module Blacklight::Document::Sms
5
- # Return a text string that will be the body of the email
6
- def to_sms_text(config = nil)
7
- body = []
8
-
9
- if config
10
- body = config.sms_fields.map do |name, field|
11
- values = [self[name]].flatten
12
- "#{field.label} #{values.first}" if self[name].present?
13
- end
14
- end
15
-
16
- # Use to_semantic_values for backwards compatibility
17
- if body.empty?
18
- semantics = to_semantic_values
19
- body << I18n.t('blacklight.sms.text.title', value: semantics[:title].first) if semantics[:title].present?
20
- body << I18n.t('blacklight.sms.text.author', value: semantics[:author].first) if semantics[:author].present?
21
- end
22
-
23
- return body.join unless body.empty?
24
- end
25
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe "Blacklight::Document::Email" do
4
- let(:config) do
5
- Blacklight::Configuration.new
6
- end
7
-
8
- before(:all) do
9
- SolrDocument.use_extension(Blacklight::Document::Email)
10
- end
11
-
12
- it "onlies return values that are available in the field semantics" do
13
- doc = SolrDocument.new(id: "1234", title_tsim: "My Title")
14
- email_body = doc.to_email_text
15
- expect(email_body).to match(/Title: My Title/)
16
- expect(email_body).not_to match(/Author/)
17
- end
18
-
19
- it "handles multi-values fields correctly" do
20
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
21
- email_body = doc.to_email_text
22
- expect(email_body).to match(/Title: My Title My Alt. Title/)
23
- end
24
-
25
- it "returns nil if there are no valid field semantics to build the email body from" do
26
- doc = SolrDocument.new(id: "1234")
27
- expect(doc.to_email_text).to be_nil
28
- end
29
-
30
- context "we pass in configuration with email fields set" do
31
- it "uses the email fields for to_email_text" do
32
- config.add_email_field("foo", label: "Foo:")
33
- config.add_email_field("bar", label: "Bar:")
34
- doc = SolrDocument.new(id: "1234", foo: ["Fuzz Fuzz", "Fizz Fizz"], bar: ["Buzz Buzz", "Bizz Bizz"])
35
-
36
- expect(doc.to_email_text(config)).to eq("Foo: Fuzz Fuzz Fizz Fizz\nBar: Buzz Buzz Bizz Bizz")
37
- end
38
- end
39
-
40
- context "we pass in configuration with email fields no set" do
41
- it "falls back on default semantics setup" do
42
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
43
- email_body = doc.to_email_text(config)
44
- expect(email_body).to match(/Title: My Title/)
45
- end
46
- end
47
-
48
- context "document field is single valued" do
49
- it "handles the single value field correctly" do
50
- config.add_email_field("foo", label: "Foo:")
51
- config.add_email_field("bar", label: "Bar:")
52
- doc = SolrDocument.new(id: "1234", foo: "Fuzz Fuzz", bar: ["Buzz Buzz", "Bizz Bizz"])
53
-
54
- expect(doc.to_email_text(config)).to eq("Foo: Fuzz Fuzz\nBar: Buzz Buzz Bizz Bizz")
55
- end
56
- end
57
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe "Blacklight::Document::Email" do
4
- let(:config) do
5
- Blacklight::Configuration.new
6
- end
7
-
8
- before(:all) do
9
- SolrDocument.use_extension(Blacklight::Document::Sms)
10
- end
11
-
12
- it "onlies return values that are available in the field semantics" do
13
- doc = SolrDocument.new(id: "1234", title_tsim: "My Title", author_tsim: "Joe Schmoe")
14
- sms_text = doc.to_sms_text
15
- expect(sms_text).to match(/My Title by Joe Schmoe/)
16
- end
17
-
18
- it "handles multi-values fields correctly and only take the first" do
19
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
20
- sms_text = doc.to_sms_text
21
- expect(sms_text).to match(/My Title/)
22
- expect(sms_text).not_to match(/My Alt\. Title/)
23
- end
24
-
25
- it "returns nil if there are no valid field semantics to build the email body from" do
26
- doc = SolrDocument.new(id: "1234")
27
- expect(doc.to_sms_text).to be_nil
28
- end
29
-
30
- context "we pass in configuration with sms fields set" do
31
- it "uses the sms fields for to_sms_text" do
32
- config.add_sms_field("foo", label: "Foo:")
33
- config.add_sms_field("bar", label: " by")
34
- doc = SolrDocument.new(id: "1234", foo: ["Fuzz Fuzz", "Fizz Fizz"], bar: ["Buzz Buzz", "Bizz Bizz"])
35
-
36
- expect(doc.to_sms_text(config)).to eq("Foo: Fuzz Fuzz by Buzz Buzz")
37
- end
38
- end
39
-
40
- context "we pass in configuration with sms fields no set" do
41
- it "falls back on default semantics setup" do
42
- doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
43
- sms_text = doc.to_sms_text(config)
44
- expect(sms_text).to match(/My Title/)
45
- expect(sms_text).not_to match(/My Alt\. Title/)
46
- end
47
- end
48
-
49
- context "document field is single valued" do
50
- it "handles the single value field correctly" do
51
- config.add_sms_field("foo", label: "Foo:")
52
- config.add_sms_field("bar", label: " by")
53
- doc = SolrDocument.new(id: "1234", foo: "Fuzz Fuzz", bar: ["Buzz Buzz", "Bizz Bizz"])
54
-
55
- expect(doc.to_sms_text(config)).to eq("Foo: Fuzz Fuzz by Buzz Buzz")
56
- end
57
- end
58
- end