blacklight 8.2.2 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +56 -62
  4. data/.rubocop.yml +226 -21
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/_mixins.scss +2 -17
  7. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  8. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  9. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -5
  10. data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
  11. data/app/views/shared/_flash_messages.html.erb +1 -1
  12. data/lib/blacklight/configuration.rb +1 -0
  13. data/lib/blacklight/nested_open_struct_with_hash_access.rb +2 -2
  14. data/lib/blacklight/solr/request.rb +1 -1
  15. data/lib/blacklight/solr/response/facets.rb +1 -1
  16. data/lib/blacklight/solr/search_builder_behavior.rb +1 -1
  17. data/package.json +1 -1
  18. data/spec/components/blacklight/advanced_search_form_component_spec.rb +2 -2
  19. data/spec/components/blacklight/constraint_layout_component_spec.rb +11 -11
  20. data/spec/components/blacklight/constraints_component_spec.rb +9 -9
  21. data/spec/components/blacklight/document/group_component_spec.rb +3 -3
  22. data/spec/components/blacklight/document/sidebar_component_spec.rb +3 -4
  23. data/spec/components/blacklight/document_component_spec.rb +21 -25
  24. data/spec/components/blacklight/facet_component_spec.rb +2 -2
  25. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +5 -5
  26. data/spec/components/blacklight/facet_field_list_component_spec.rb +13 -13
  27. data/spec/components/blacklight/facet_item_component_spec.rb +5 -5
  28. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +6 -6
  29. data/spec/components/blacklight/header_component_spec.rb +1 -2
  30. data/spec/components/blacklight/hidden_search_state_component_spec.rb +6 -6
  31. data/spec/components/blacklight/metadata_field_component_spec.rb +3 -3
  32. data/spec/components/blacklight/response/pagination_component_spec.rb +4 -4
  33. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +1 -1
  34. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +1 -3
  35. data/spec/components/blacklight/system/flash_message_component_spec.rb +5 -5
  36. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  37. data/spec/controllers/blacklight/{catalog/component_configuration_spec.rb → configurable_spec.rb} +1 -1
  38. data/spec/controllers/bookmarks_controller_spec.rb +10 -10
  39. data/spec/controllers/catalog_controller_spec.rb +24 -26
  40. data/spec/features/advanced_search_spec.rb +14 -14
  41. data/spec/features/alternate_controller_spec.rb +9 -9
  42. data/spec/features/axe_spec.rb +4 -4
  43. data/spec/features/bookmarks_spec.rb +19 -19
  44. data/spec/features/citation_spec.rb +1 -1
  45. data/spec/features/did_you_mean_spec.rb +23 -23
  46. data/spec/features/facet_missing_spec.rb +9 -9
  47. data/spec/features/facets_spec.rb +21 -20
  48. data/spec/features/modal_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +2 -2
  50. data/spec/features/search_context_spec.rb +6 -6
  51. data/spec/features/search_crawler_spec.rb +5 -5
  52. data/spec/features/search_filters_spec.rb +65 -65
  53. data/spec/features/search_history_spec.rb +12 -12
  54. data/spec/features/search_pagination_spec.rb +10 -10
  55. data/spec/features/search_results_spec.rb +1 -1
  56. data/spec/features/search_sort_spec.rb +4 -4
  57. data/spec/features/search_spec.rb +25 -25
  58. data/spec/features/sitelinks_search_box_spec.rb +2 -2
  59. data/spec/features/sms_spec.rb +1 -1
  60. data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
  61. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +2 -1
  62. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +7 -8
  63. data/spec/helpers/blacklight_helper_spec.rb +13 -15
  64. data/spec/helpers/catalog_helper_spec.rb +3 -6
  65. data/spec/i18n_spec.rb +2 -1
  66. data/spec/lib/blacklight/search_state_spec.rb +4 -4
  67. data/spec/lib/tasks/blacklight_task_spec.rb +2 -1
  68. data/spec/models/blacklight/configurable_spec.rb +1 -1
  69. data/spec/models/blacklight/configuration/context_spec.rb +1 -1
  70. data/spec/models/blacklight/configuration_spec.rb +2 -2
  71. data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -1
  72. data/spec/models/blacklight/document/cache_key_spec.rb +1 -1
  73. data/spec/models/blacklight/document_spec.rb +1 -1
  74. data/spec/models/blacklight/facet_paginator_spec.rb +14 -14
  75. data/spec/models/blacklight/icon_spec.rb +1 -1
  76. data/spec/models/blacklight/search_builder_spec.rb +1 -1
  77. data/spec/models/blacklight/solr/document_spec.rb +1 -1
  78. data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -1
  79. data/spec/models/blacklight/solr/repository_spec.rb +2 -2
  80. data/spec/models/blacklight/solr/request_spec.rb +1 -1
  81. data/spec/models/blacklight/solr/response/facets_spec.rb +1 -1
  82. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
  83. data/spec/models/blacklight/solr/response/group_spec.rb +1 -1
  84. data/spec/models/blacklight/solr/response_spec.rb +1 -1
  85. data/spec/models/blacklight/solr/{search_builder_spec.rb → search_builder_behavior_spec.rb} +9 -19
  86. data/spec/models/blacklight/suggest/response_spec.rb +1 -1
  87. data/spec/models/blacklight/suggest_search_spec.rb +1 -1
  88. data/spec/models/blacklight/user_spec.rb +1 -1
  89. data/spec/models/solr_document_spec.rb +1 -1
  90. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -2
  91. data/spec/presenters/blacklight/field_presenter_spec.rb +1 -1
  92. data/spec/presenters/blacklight/index_presenter_spec.rb +2 -3
  93. data/spec/presenters/blacklight/json_presenter_spec.rb +1 -1
  94. data/spec/presenters/{pipeline_spec.rb → blacklight/rendering/pipeline_spec.rb} +1 -1
  95. data/spec/presenters/blacklight/show_presenter_spec.rb +5 -6
  96. data/spec/presenters/{thumbnail_presenter_spec.rb → blacklight/thumbnail_presenter_spec.rb} +5 -3
  97. data/spec/routing/catalog_routing_spec.rb +1 -1
  98. data/spec/services/blacklight/field_retriever_spec.rb +1 -1
  99. data/spec/services/blacklight/search_service_spec.rb +9 -9
  100. data/spec/spec_helper.rb +2 -2
  101. data/spec/support/features/search_helpers.rb +2 -2
  102. data/spec/support/features/session_helpers.rb +3 -3
  103. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
  104. data/spec/views/catalog/_document.html.erb_spec.rb +1 -4
  105. data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -2
  106. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -6
  107. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +7 -7
  108. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +4 -4
  109. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -4
  110. data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -2
  111. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -7
  112. data/spec/views/catalog/email_success.html.erb_spec.rb +1 -1
  113. data/spec/views/catalog/facet.html.erb_spec.rb +1 -1
  114. data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
  115. data/spec/views/catalog/index.atom.builder_spec.rb +18 -19
  116. data/spec/views/catalog/index.html.erb_spec.rb +2 -4
  117. data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -8
  118. data/spec/views/catalog/show.html.erb_spec.rb +3 -5
  119. data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -2
  120. data/spec/views/catalog/sms_success.html.erb_spec.rb +1 -1
  121. data/spec/views/shared/_user_util_links.html.erb_spec.rb +2 -3
  122. metadata +10 -10
@@ -15,8 +15,8 @@ RSpec.describe BookmarksController do
15
15
  it "has a 200 status code when creating a new one" do
16
16
  put :update, xhr: true, params: { id: '2007020969', format: :js }
17
17
  expect(response).to be_successful
18
- expect(response.code).to eq "200"
19
- expect(JSON.parse(response.body)["bookmarks"]["count"]).to eq 1
18
+ expect(response).to have_http_status :ok
19
+ expect(response.parsed_body["bookmarks"]["count"]).to eq 1
20
20
  end
21
21
 
22
22
  it "has a 500 status code when create is not success" do
@@ -26,7 +26,7 @@ RSpec.describe BookmarksController do
26
26
  allow(@controller).to receive_message_chain(:current_or_guest_user, :bookmarks, :create!).and_raise(ActiveRecord::RecordInvalid)
27
27
  allow(@controller).to receive_message_chain(:current_or_guest_user, :errors, :full_messages).and_return([1])
28
28
  put :update, xhr: true, params: { id: 'iamabooboo', format: :js }
29
- expect(response.code).to eq "500"
29
+ expect(response).to have_http_status :internal_server_error
30
30
  end
31
31
  end
32
32
 
@@ -44,8 +44,8 @@ RSpec.describe BookmarksController do
44
44
  }
45
45
 
46
46
  expect(response).to be_successful
47
- expect(response.code).to eq "200"
48
- expect(JSON.parse(response.body)["bookmarks"]["count"]).to eq 3
47
+ expect(response).to have_http_status :ok
48
+ expect(response.parsed_body["bookmarks"]["count"]).to eq 3
49
49
  end
50
50
  end
51
51
 
@@ -58,8 +58,8 @@ RSpec.describe BookmarksController do
58
58
  it "has a 200 status code when delete is success" do
59
59
  delete :destroy, xhr: true, params: { id: '2007020969', format: :js }
60
60
  expect(response).to be_successful
61
- expect(response.code).to eq "200"
62
- expect(JSON.parse(response.body)["bookmarks"]["count"]).to eq 0
61
+ expect(response).to have_http_status :ok
62
+ expect(response.parsed_body["bookmarks"]["count"]).to eq 0
63
63
  end
64
64
 
65
65
  it "can handle bookmark deletion via :bookmarks param" do
@@ -74,8 +74,8 @@ RSpec.describe BookmarksController do
74
74
  format: :js
75
75
  }
76
76
  expect(response).to be_successful
77
- expect(response.code).to eq "200"
78
- expect(JSON.parse(response.body)["bookmarks"]["count"]).to eq 0
77
+ expect(response).to have_http_status :ok
78
+ expect(response.parsed_body["bookmarks"]["count"]).to eq 0
79
79
  end
80
80
 
81
81
  it "has a 500 status code when delete is not success" do
@@ -85,7 +85,7 @@ RSpec.describe BookmarksController do
85
85
 
86
86
  delete :destroy, xhr: true, params: { id: 'pleasekillme', format: :js }
87
87
 
88
- expect(response.code).to eq "500"
88
+ expect(response).to have_http_status :internal_server_error
89
89
  end
90
90
  end
91
91
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe CatalogController, api: true do
3
+ RSpec.describe CatalogController, :api do
4
4
  let(:doc_id) { '2007020969' }
5
5
  let(:mock_document) { instance_double(SolrDocument, export_formats: {}) }
6
6
  let(:search_service) { instance_double(Blacklight::SearchService) }
@@ -24,26 +24,26 @@ RSpec.describe CatalogController, api: true do
24
24
  end
25
25
 
26
26
  # check each user manipulated parameter
27
- it "has docs and facets for query with results", integration: true do
27
+ it "has docs and facets for query with results", :integration do
28
28
  get :index, params: { q: user_query }
29
29
  expect(assigns(:response).docs).not_to be_empty
30
30
  assert_facets_have_values(assigns(:response).aggregations)
31
31
  end
32
32
 
33
- it "has docs and facets for existing facet value", integration: true do
33
+ it "has docs and facets for existing facet value", :integration do
34
34
  get :index, params: { f: { "format" => 'Book' } }
35
35
  expect(assigns(:response).docs).not_to be_empty
36
36
  assert_facets_have_values(assigns(:response).aggregations)
37
37
  end
38
38
 
39
- it "has docs and facets for non-default results per page", integration: true do
39
+ it "has docs and facets for non-default results per page", :integration do
40
40
  num_per_page = 7
41
41
  get :index, params: { per_page: num_per_page }
42
42
  expect(assigns(:response).docs).to have(num_per_page).items
43
43
  assert_facets_have_values(assigns(:response).aggregations)
44
44
  end
45
45
 
46
- it "has docs and facets for second page", integration: true do
46
+ it "has docs and facets for second page", :integration do
47
47
  page = 2
48
48
  get :index, params: { page: page }
49
49
  expect(assigns(:response).docs).not_to be_empty
@@ -51,7 +51,7 @@ RSpec.describe CatalogController, api: true do
51
51
  assert_facets_have_values(assigns(:response).aggregations)
52
52
  end
53
53
 
54
- it "has no docs or facet values for query without results", integration: true do
54
+ it "has no docs or facet values for query without results", :integration do
55
55
  get :index, params: { q: 'sadfdsafasdfsadfsadfsadf' } # query for no results
56
56
  expect(assigns(:response).docs).to be_empty
57
57
  assigns(:response).aggregations.each_value do |facet|
@@ -59,12 +59,12 @@ RSpec.describe CatalogController, api: true do
59
59
  end
60
60
  end
61
61
 
62
- it "shows 0 results when the user asks for an invalid value to a custom facet query", integration: true do
62
+ it "shows 0 results when the user asks for an invalid value to a custom facet query", :integration do
63
63
  get :index, params: { f: { example_query_facet_field: ['bogus'] } } # bogus custom facet value
64
64
  expect(assigns(:response).docs).to be_empty
65
65
  end
66
66
 
67
- it "returns results (possibly 0) when the user asks for a valid value to a custom facet query", integration: true do
67
+ it "returns results (possibly 0) when the user asks for a valid value to a custom facet query", :integration do
68
68
  get :index, params: { f: { example_query_facet_field: ['years_25'] } } # valid custom facet value with some results
69
69
  expect(assigns(:response).docs).not_to be_empty
70
70
  end
@@ -74,7 +74,7 @@ RSpec.describe CatalogController, api: true do
74
74
  expect(assigns(:response).docs).to be_empty
75
75
  end
76
76
 
77
- it "has a spelling suggestion for an appropriately poor query", integration: true do
77
+ it "has a spelling suggestion for an appropriately poor query", :integration do
78
78
  get :index, params: { q: 'boo' }
79
79
  expect(assigns(:response).spelling.words).not_to be_nil
80
80
  end
@@ -95,12 +95,12 @@ RSpec.describe CatalogController, api: true do
95
95
 
96
96
  # check with no user manipulation
97
97
  describe "for default query" do
98
- it "gets documents when no query", integration: true do
98
+ it "gets documents when no query", :integration do
99
99
  get :index
100
100
  expect(assigns(:response).docs).not_to be_empty
101
101
  end
102
102
 
103
- it "gets facets when no query", integration: true do
103
+ it "gets facets when no query", :integration do
104
104
  get :index
105
105
  assert_facets_have_values(assigns(:response).aggregations)
106
106
  end
@@ -113,14 +113,14 @@ RSpec.describe CatalogController, api: true do
113
113
  end
114
114
 
115
115
  # NOTE: status code is always 200 in isolation mode ...
116
- it "HTTP status code for GET should be 200", integration: true do
116
+ it "HTTP status code for GET should be 200", :integration do
117
117
  get :index
118
118
  expect(response).to be_successful
119
119
  end
120
120
  end
121
121
 
122
122
  describe "with format :rss" do
123
- it "gets the feed", integration: true do
123
+ it "gets the feed", :integration do
124
124
  get :index, params: { format: 'rss' }
125
125
  expect(response).to be_successful
126
126
  end
@@ -133,7 +133,7 @@ RSpec.describe CatalogController, api: true do
133
133
  expect(response).to be_successful
134
134
  end
135
135
 
136
- let(:json) { JSON.parse(response.body) }
136
+ let(:json) { response.parsed_body }
137
137
  let(:pages) { json['meta']['pages'] }
138
138
  let(:docs) { json['data'] }
139
139
  let(:facets) { json['included'].select { |x| x['type'] == 'facet' } }
@@ -251,7 +251,7 @@ RSpec.describe CatalogController, api: true do
251
251
 
252
252
  it "HTTP status code for redirect should be 303" do
253
253
  put :track, params: { id: doc_id, counter: 3 }
254
- expect(response.status).to eq 303
254
+ expect(response).to have_http_status :see_other
255
255
  end
256
256
 
257
257
  it "redirects to the path given in the redirect param" do
@@ -285,7 +285,7 @@ RSpec.describe CatalogController, api: true do
285
285
  it "gets the raw solr document" do
286
286
  get :raw, params: { id: doc_id, format: 'json' }
287
287
  expect(response).to be_successful
288
- json = JSON.parse response.body
288
+ json = response.parsed_body
289
289
  expect(json.keys).to match_array(
290
290
  %w[id _version_ author_addl_tsim author_tsim format isbn_ssim
291
291
  language_ssim lc_1letter_ssim lc_alpha_ssim lc_b4cutter_ssim
@@ -310,7 +310,7 @@ RSpec.describe CatalogController, api: true do
310
310
  # SHOW ACTION
311
311
  describe "show action" do
312
312
  describe "with format :html" do
313
- it "gets document", integration: true do
313
+ it "gets document", :integration do
314
314
  get :show, params: { id: doc_id }
315
315
  expect(assigns[:document]).not_to be_nil
316
316
  end
@@ -321,7 +321,7 @@ RSpec.describe CatalogController, api: true do
321
321
  it "gets the feed" do
322
322
  get :show, params: { id: doc_id, format: 'json' }
323
323
  expect(response).to be_successful
324
- json = JSON.parse response.body
324
+ json = response.parsed_body
325
325
  expect(json["data"]["attributes"].keys).to match_array(
326
326
  %w[author_tsim format isbn_ssim language_ssim lc_callnum_ssim
327
327
  published_ssim subtitle_tsim title title_tsim url_suppl_ssim]
@@ -335,9 +335,8 @@ RSpec.describe CatalogController, api: true do
335
335
 
336
336
  before do
337
337
  allow(mock_document).to receive_messages(export_formats: {})
338
- allow(controller).to receive(:search_service).and_return(search_service)
339
338
  expect(search_service).to receive(:fetch).and_return(mock_document)
340
- allow(controller).to receive(:current_search_session).and_return(current_search)
339
+ allow(controller).to receive_messages(search_service: search_service, current_search_session: current_search)
341
340
  end
342
341
 
343
342
  context 'if counter is present in session' do
@@ -389,7 +388,7 @@ RSpec.describe CatalogController, api: true do
389
388
  end
390
389
 
391
390
  # NOTE: status code is always 200 in isolation mode ...
392
- it "HTTP status code for GET should be 200", integration: true do
391
+ it "HTTP status code for GET should be 200", :integration do
393
392
  get :show, params: { id: doc_id }
394
393
  expect(response).to be_successful
395
394
  end
@@ -624,7 +623,7 @@ RSpec.describe CatalogController, api: true do
624
623
  it "is successful" do
625
624
  get :facet, params: { id: 'format', format: 'json' }
626
625
  expect(response).to be_successful
627
- json = JSON.parse(response.body)
626
+ json = response.parsed_body
628
627
  expect(json["response"]["facets"]["items"].first["value"]).to eq 'Book'
629
628
  end
630
629
  end
@@ -741,8 +740,7 @@ RSpec.describe CatalogController, api: true do
741
740
  describe "#add_show_tools_partial", api: false do
742
741
  before do
743
742
  described_class.blacklight_config.add_show_tools_partial(:like, callback: :perform_like, validator: :validate_like_params)
744
- allow(controller).to receive(:solr_document_url).and_return('http://test.host/catalog/1')
745
- allow(controller).to receive(:action_documents).and_return(1)
743
+ allow(controller).to receive_messages(solr_document_url: 'http://test.host/catalog/1', action_documents: 1)
746
744
  Rails.application.routes.draw do
747
745
  get 'catalog/like', as: :catalog_like
748
746
  end
@@ -796,7 +794,7 @@ RSpec.describe CatalogController, api: true do
796
794
  end
797
795
 
798
796
  describe "page_links" do
799
- it "has prev/next docs and result set data for non-empty result sets", integration: true do
797
+ it "has prev/next docs and result set data for non-empty result sets", :integration do
800
798
  get :page_links, params: { f: { "format" => 'Book' }, counter: 2 }
801
799
  expect(assigns(:page_link_data)).not_to be_empty
802
800
  expect(assigns(:page_link_data).fetch(:prev, nil)).to end_with('counter=1')
@@ -804,7 +802,7 @@ RSpec.describe CatalogController, api: true do
804
802
  expect(assigns(:page_link_data).fetch(:totalRaw, nil)).to be 30
805
803
  end
806
804
 
807
- it "is empty for empty result sets", integration: true do
805
+ it "is empty for empty result sets", :integration do
808
806
  get :page_links, params: { f: { "format" => 'empty-result-set' }, counter: 1 }
809
807
  expect(assigns(:page_link_data)).to be_empty
810
808
  end
@@ -27,16 +27,16 @@ RSpec.describe "Blacklight Advanced Search Form" do
27
27
  end
28
28
 
29
29
  it "has field and facet blocks" do
30
- expect(page).to have_selector('.query-criteria')
31
- expect(page).to have_selector('.limit-criteria')
30
+ expect(page).to have_css('.query-criteria')
31
+ expect(page).to have_css('.limit-criteria')
32
32
  end
33
33
 
34
34
  describe "query column" do
35
35
  it "gives the user a choice between and/or queries" do
36
- expect(page).to have_selector('#op')
36
+ expect(page).to have_css('#op')
37
37
  within('#op') do
38
- expect(page).to have_selector('option[value="must"]')
39
- expect(page).to have_selector('option[value="should"]')
38
+ expect(page).to have_css('option[value="must"]')
39
+ expect(page).to have_css('option[value="should"]')
40
40
  end
41
41
  end
42
42
 
@@ -50,7 +50,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
50
50
 
51
51
  describe "facet column" do
52
52
  it "lists facets" do
53
- expect(page).to have_selector('.blacklight-language_ssim')
53
+ expect(page).to have_css('.blacklight-language_ssim')
54
54
 
55
55
  within('.blacklight-language_ssim') do
56
56
  expect(page).to have_content 'Language'
@@ -63,7 +63,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
63
63
  click_on 'advanced-search-submit'
64
64
  expect(page).to have_content 'Remove constraint Title: Medicine'
65
65
  expect(page).to have_content 'Strong Medicine speaks'
66
- expect(page).to have_selector('article.document', count: 1)
66
+ expect(page).to have_css('article.document', count: 1)
67
67
  end
68
68
 
69
69
  it 'can limit to facets' do
@@ -72,16 +72,16 @@ RSpec.describe "Blacklight Advanced Search Form" do
72
72
  check 'Urdu 3'
73
73
  click_on 'advanced-search-submit'
74
74
  expect(page).to have_content 'Pākistānī ʻaurat dorāhe par'
75
- expect(page).not_to have_content 'Ajikto kŭrŏk chŏrŏk sasimnikka : and 아직도 그럭 저럭 사십니까'
76
- expect(page).to have_selector('article.document', count: 1)
75
+ expect(page).to have_no_content 'Ajikto kŭrŏk chŏrŏk sasimnikka : and 아직도 그럭 저럭 사십니까'
76
+ expect(page).to have_css('article.document', count: 1)
77
77
  end
78
78
 
79
79
  it 'handles boolean queries' do
80
80
  fill_in 'All Fields', with: 'history NOT strong'
81
81
  click_on 'advanced-search-submit'
82
82
  expect(page).to have_content('Ci an zhou bian')
83
- expect(page).not_to have_content('Strong Medicine speaks')
84
- expect(page).to have_selector('article.document', count: 10)
83
+ expect(page).to have_no_content('Strong Medicine speaks')
84
+ expect(page).to have_css('article.document', count: 10)
85
85
  end
86
86
 
87
87
  it 'handles queries in multiple fields with the ALL operator' do
@@ -89,7 +89,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
89
89
  fill_in 'Author', with: 'hearth'
90
90
  click_on 'advanced-search-submit'
91
91
  expect(page).to have_content('Strong Medicine speaks')
92
- expect(page).to have_selector('article.document', count: 1)
92
+ expect(page).to have_css('article.document', count: 1)
93
93
  end
94
94
 
95
95
  it 'handles queries in multiple fields with the ANY operator' do
@@ -99,7 +99,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
99
99
  click_on 'advanced-search-submit'
100
100
  expect(page).to have_content('Ci an zhou bian')
101
101
  expect(page).to have_content('Pākistānī ʻaurat dorāhe par')
102
- expect(page).to have_selector('article.document', count: 10)
102
+ expect(page).to have_css('article.document', count: 10)
103
103
  end
104
104
  end
105
105
 
@@ -122,7 +122,7 @@ RSpec.describe "Blacklight Advanced Search Form" do
122
122
  it "clears the prepopulated fields when the Start Over button is pressed" do
123
123
  expect(page).to have_field 'Title', with: 'medicine'
124
124
  click_on 'Start over'
125
- expect(page).not_to have_field 'Title', with: 'medicine'
125
+ expect(page).to have_no_field 'Title', with: 'medicine'
126
126
  end
127
127
  end
128
128
  end
@@ -3,9 +3,9 @@
3
3
  RSpec.describe "Alternate Controller Behaviors" do
4
4
  it "has the correct per-page form" do
5
5
  visit search_alternate_path
6
- expect(page).to have_selector("form[action='#{search_alternate_url}']")
6
+ expect(page).to have_css("form[action='#{search_alternate_url}']")
7
7
  fill_in "q", with: "history"
8
- click_button 'search'
8
+ click_on 'search'
9
9
  expect(current_path).to match /#{search_alternate_path}/
10
10
  within "#per_page-dropdown .dropdown-menu" do
11
11
  click_on '10 per page'
@@ -15,9 +15,9 @@ RSpec.describe "Alternate Controller Behaviors" do
15
15
 
16
16
  it "has the correct search field form" do
17
17
  visit search_alternate_path
18
- expect(page).to have_selector("form[action='#{search_alternate_url}']")
18
+ expect(page).to have_css("form[action='#{search_alternate_url}']")
19
19
  fill_in "q", with: "history"
20
- click_button 'search'
20
+ click_on 'search'
21
21
  expect(current_path).to match /#{search_alternate_path}/
22
22
  click_on 'relevance'
23
23
  expect(current_path).to match /#{search_alternate_path}/
@@ -25,11 +25,11 @@ RSpec.describe "Alternate Controller Behaviors" do
25
25
 
26
26
  it "displays document thumbnails" do
27
27
  visit search_alternate_path
28
- expect(page).to have_selector("form[action='#{search_alternate_url}']")
28
+ expect(page).to have_css("form[action='#{search_alternate_url}']")
29
29
  fill_in "q", with: "history"
30
- click_button 'search'
31
- expect(page).to have_selector ".document-thumbnail"
32
- expect(page).to have_selector ".document-thumbnail a[data-context-href]"
33
- expect(page).to have_selector ".document-thumbnail a img"
30
+ click_on 'search'
31
+ expect(page).to have_css ".document-thumbnail"
32
+ expect(page).to have_css ".document-thumbnail a[data-context-href]"
33
+ expect(page).to have_css ".document-thumbnail a img"
34
34
  end
35
35
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe 'Accessibility testing', api: false, js: true do
3
+ RSpec.describe 'Accessibility testing', :js, api: false do
4
4
  it 'validates the home page' do
5
5
  visit root_path
6
6
  expect(page).to be_accessible
@@ -9,13 +9,13 @@ RSpec.describe 'Accessibility testing', api: false, js: true do
9
9
  it 'validates the catalog page' do
10
10
  visit root_path
11
11
  fill_in "q", with: 'history'
12
- click_button 'search'
12
+ click_on 'search'
13
13
 
14
14
  expect(page).to be_accessible
15
15
 
16
16
  within '.card.blacklight-language_ssim' do
17
- click_button 'Language'
18
- click_link "Tibetan"
17
+ click_on 'Language'
18
+ click_on "Tibetan"
19
19
  end
20
20
 
21
21
  expect(page).to be_accessible
@@ -5,16 +5,16 @@ RSpec.describe "Bookmarks" do
5
5
  it "has a link to the history page" do
6
6
  sign_in 'user1'
7
7
  visit root_path
8
- click_link 'Bookmarks'
8
+ click_on 'Bookmarks'
9
9
  expect(page).to have_content 'You have no bookmarks'
10
10
  end
11
11
  end
12
12
 
13
13
  it "clears bookmarks" do
14
14
  visit solr_document_path('2007020969')
15
- click_button 'Bookmark'
16
- click_link 'Bookmarks'
17
- click_link 'Clear Bookmarks'
15
+ click_on 'Bookmark'
16
+ click_on 'Bookmarks'
17
+ click_on 'Clear Bookmarks'
18
18
  expect(page).to have_content 'Cleared your bookmarks.'
19
19
  expect(page).to have_content 'You have no bookmarks'
20
20
  end
@@ -23,24 +23,24 @@ RSpec.describe "Bookmarks" do
23
23
  sign_in 'user1'
24
24
  visit root_path
25
25
  fill_in "q", with: 'Sumadhvavijayaḥ'
26
- click_button 'search'
27
- click_button 'Bookmark'
26
+ click_on 'search'
27
+ click_on 'Bookmark'
28
28
  expect(page).to have_content 'Successfully added bookmark.'
29
29
  fill_in "q", with: 'Sumadhvavijayaḥ'
30
- click_button 'search'
31
- click_button 'Remove bookmark'
30
+ click_on 'search'
31
+ click_on 'Remove bookmark'
32
32
  expect(page).to have_content 'Successfully removed bookmark.'
33
33
  end
34
34
 
35
35
  it "adds and delete bookmarks from the show page" do
36
36
  sign_in 'user1'
37
37
  visit solr_document_path('2007020969')
38
- click_button 'Bookmark'
39
- click_button 'Remove bookmark'
38
+ click_on 'Bookmark'
39
+ click_on 'Remove bookmark'
40
40
  expect(page).to have_content 'Successfully removed bookmark.'
41
41
  end
42
42
 
43
- it 'shows bookmarks as checkboxes', js: true do
43
+ it 'shows bookmarks as checkboxes', :js do
44
44
  visit solr_document_path('2007020969')
45
45
  check 'Bookmark'
46
46
 
@@ -51,7 +51,7 @@ RSpec.describe "Bookmarks" do
51
51
 
52
52
  it "adds bookmarks after a user logs in" do
53
53
  visit solr_document_path('2007020969')
54
- click_button 'Bookmark'
54
+ click_on 'Bookmark'
55
55
  sign_in 'user1'
56
56
  visit bookmarks_path
57
57
  expect(page).to have_button("Remove bookmark")
@@ -60,24 +60,24 @@ RSpec.describe "Bookmarks" do
60
60
 
61
61
  it "cites items in bookmarks" do
62
62
  visit solr_document_path('2007020969')
63
- click_button 'Bookmark'
64
- click_link 'Bookmarks'
65
- click_link 'Cite'
63
+ click_on 'Bookmark'
64
+ click_on 'Bookmarks'
65
+ click_on 'Cite'
66
66
  expect(page).to have_content 'Strong Medicine speaks'
67
67
  end
68
68
 
69
69
  it "cites all items in current bookmarks" do
70
70
  visit solr_document_path('2009373513') # Ci an zhou bian
71
- click_button 'Bookmark'
71
+ click_on 'Bookmark'
72
72
 
73
73
  visit solr_document_path('2007020969') # Strong Medicine speaks
74
- click_button 'Bookmark'
74
+ click_on 'Bookmark'
75
75
 
76
76
  visit "/bookmarks?per_page=1"
77
77
  expect(page).to have_content 'Strong Medicine speaks'
78
- expect(page).not_to have_content 'Ci an zhou bian'
78
+ expect(page).to have_no_content 'Ci an zhou bian'
79
79
 
80
- click_link 'Cite'
80
+ click_on 'Cite'
81
81
  expect(page).to have_content 'Strong Medicine speaks'
82
82
  expect(page).to have_content 'Ci an zhou bian'
83
83
  end
@@ -4,7 +4,7 @@ RSpec.describe 'Citation functionality' do
4
4
  before { visit solr_document_path('2007020969') }
5
5
 
6
6
  it 'displays the Cite modal with expected header' do
7
- click_link 'Cite'
7
+ click_on 'Cite'
8
8
  expect(find('div.modal-header')).to have_text 'Cite'
9
9
  end
10
10
  end
@@ -6,10 +6,10 @@ RSpec.describe "Did You Mean" do
6
6
  describe "searching all fields" do
7
7
  it "has suggestions" do
8
8
  fill_in "q", with: 'politica'
9
- click_button 'search'
9
+ click_on 'search'
10
10
 
11
11
  expect(page).to have_content("Did you mean")
12
- click_link 'policy'
12
+ click_on 'policy'
13
13
  within ("#sortAndPerPage") do
14
14
  expect(page).to have_content "1 - 2 of 2"
15
15
  end
@@ -22,15 +22,15 @@ RSpec.describe "Did You Mean" do
22
22
  it "has suggestions" do
23
23
  # yehudiyam is one letter away from a title word
24
24
  fill_in "q", with: 'yehudiyam'
25
- click_button 'search'
25
+ click_on 'search'
26
26
 
27
27
  expect(page).to have_content("Did you mean")
28
- click_link 'yehudiyim'
28
+ click_on 'yehudiyim'
29
29
  within ("#sortAndPerPage") do
30
30
  expect(page).to have_content "1 entry found"
31
31
  end
32
32
  within ("select#search_field") do
33
- expect(page).to have_selector("option[selected]", text: "Title")
33
+ expect(page).to have_css("option[selected]", text: "Title")
34
34
  end
35
35
  end
36
36
  end
@@ -41,15 +41,15 @@ RSpec.describe "Did You Mean" do
41
41
  it "has suggestions" do
42
42
  # shirma is one letter away from an author word
43
43
  fill_in "q", with: 'shirma'
44
- click_button 'search'
44
+ click_on 'search'
45
45
 
46
46
  expect(page).to have_content("Did you mean")
47
- click_link 'sharma'
47
+ click_on 'sharma'
48
48
  within ("#sortAndPerPage") do
49
49
  expect(page).to have_content "1 entry found"
50
50
  end
51
51
  within ("select#search_field") do
52
- expect(page).to have_selector("option[selected]", text: "Author")
52
+ expect(page).to have_css("option[selected]", text: "Author")
53
53
  end
54
54
  end
55
55
  end
@@ -60,15 +60,15 @@ RSpec.describe "Did You Mean" do
60
60
  it "has suggestions" do
61
61
  # wome is one letter away from an author word
62
62
  fill_in "q", with: 'wome'
63
- click_button 'search'
63
+ click_on 'search'
64
64
 
65
65
  expect(page).to have_content("Did you mean")
66
- click_link 'women'
66
+ click_on 'women'
67
67
  within ("#sortAndPerPage") do
68
68
  expect(page).to have_content "1 - 3 of 3"
69
69
  end
70
70
  within ("select#search_field") do
71
- expect(page).to have_selector("option[selected]", text: "Subject")
71
+ expect(page).to have_css("option[selected]", text: "Subject")
72
72
  end
73
73
  end
74
74
  end
@@ -76,23 +76,23 @@ RSpec.describe "Did You Mean" do
76
76
  describe "a multiword query" do
77
77
  it "does not have suggestions if there are no matches" do
78
78
  fill_in "q", with: 'ooofda ooofda'
79
- click_button 'search'
79
+ click_on 'search'
80
80
 
81
- expect(page).not_to have_content("Did you mean")
81
+ expect(page).to have_no_content("Did you mean")
82
82
  end
83
83
 
84
84
  it "has separate suggestions" do
85
85
  fill_in "q", with: 'politica boo'
86
- click_button 'search'
86
+ click_on 'search'
87
87
 
88
88
  within(".suggest") do
89
89
  expect(page).to have_content("Did you mean")
90
90
  expect(page).to have_link('policy')
91
91
  expect(page).to have_link('bon')
92
- expect(page).not_to have_link('policy bon')
92
+ expect(page).to have_no_link('policy bon')
93
93
  end
94
94
 
95
- click_link 'bon'
95
+ click_on 'bon'
96
96
  within ("#sortAndPerPage") do
97
97
  expect(page).to have_content "1 entry found"
98
98
  end
@@ -100,22 +100,22 @@ RSpec.describe "Did You Mean" do
100
100
 
101
101
  it "ignores repeated terms" do
102
102
  fill_in "q", with: 'boo boo'
103
- click_button 'search'
103
+ click_on 'search'
104
104
 
105
105
  within(".suggest") do
106
106
  expect(page).to have_content("Did you mean")
107
107
  expect(page).to have_link('bon', count: 1)
108
- expect(page).not_to have_link('bon bon')
108
+ expect(page).to have_no_link('bon bon')
109
109
  end
110
110
  end
111
111
  end
112
112
 
113
113
  it "shows suggestions if there aren't many hits" do
114
114
  fill_in "q", with: 'ayaz'
115
- click_button 'search'
115
+ click_on 'search'
116
116
 
117
117
  expect(page).to have_content("Did you mean")
118
- click_link 'bya'
118
+ click_on 'bya'
119
119
  within ("#sortAndPerPage") do
120
120
  expect(page).to have_content "1 - 3 of 3"
121
121
  end
@@ -124,7 +124,7 @@ RSpec.describe "Did You Mean" do
124
124
  it "shows suggestions if at the threshold number" do
125
125
  # polit gives 5 results in 30 record demo index - 5 is default cutoff
126
126
  fill_in "q", with: 'polit'
127
- click_button 'search'
127
+ click_on 'search'
128
128
  expect(page).to have_content("Did you mean")
129
129
  end
130
130
 
@@ -139,10 +139,10 @@ RSpec.describe "Did You Mean" do
139
139
 
140
140
  it "shows suggestions if there aren't many hits" do
141
141
  fill_in "q", with: 'Yoshido Hajime'
142
- click_button 'search'
142
+ click_on 'search'
143
143
 
144
144
  expect(page).to have_content("Did you mean")
145
- click_link 'yoshida Hajime'
145
+ click_on 'yoshida Hajime'
146
146
  within ("#sortAndPerPage") do
147
147
  expect(page).to have_content "1 - 2 of 2"
148
148
  end