blacklight-spotlight 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spotlight/_nestable.scss +10 -23
  3. data/app/controllers/concerns/spotlight/controller.rb +12 -0
  4. data/app/controllers/spotlight/browse_controller.rb +7 -1
  5. data/app/controllers/spotlight/catalog_controller.rb +2 -2
  6. data/app/controllers/spotlight/concerns/user_invitable.rb +10 -2
  7. data/app/controllers/spotlight/contact_forms_controller.rb +1 -1
  8. data/app/controllers/spotlight/lock_controller.rb +1 -1
  9. data/app/controllers/spotlight/pages_controller.rb +1 -1
  10. data/app/controllers/spotlight/resources/csv_upload_controller.rb +2 -2
  11. data/app/controllers/spotlight/roles_controller.rb +1 -1
  12. data/app/controllers/spotlight/searches_controller.rb +8 -3
  13. data/app/controllers/spotlight/solr_controller.rb +26 -7
  14. data/app/controllers/spotlight/versions_controller.rb +1 -1
  15. data/app/helpers/spotlight/application_helper.rb +0 -4
  16. data/app/helpers/spotlight/pages_helper.rb +9 -1
  17. data/app/models/concerns/spotlight/resources/open_graph.rb +11 -1
  18. data/app/models/concerns/spotlight/user.rb +1 -1
  19. data/app/models/spotlight/resources/json_upload.rb +8 -0
  20. data/app/views/spotlight/featured_images/_form.html.erb +5 -1
  21. data/app/views/spotlight/featured_images/_upload_form.html.erb +5 -1
  22. data/app/views/spotlight/resources/json_upload/_form.html.erb +15 -0
  23. data/config/locales/spotlight.en.yml +5 -0
  24. data/lib/generators/spotlight/install_generator.rb +2 -0
  25. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +58 -0
  26. data/lib/spotlight/engine.rb +6 -1
  27. data/lib/spotlight/version.rb +1 -1
  28. data/spec/controllers/spotlight/about_pages_controller_spec.rb +33 -22
  29. data/spec/controllers/spotlight/admin_users_controller_spec.rb +9 -9
  30. data/spec/controllers/spotlight/appearances_controller_spec.rb +11 -8
  31. data/spec/controllers/spotlight/attachments_controller_spec.rb +2 -2
  32. data/spec/controllers/spotlight/browse_controller_spec.rb +5 -5
  33. data/spec/controllers/spotlight/catalog_controller_spec.rb +31 -31
  34. data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -1
  35. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +4 -4
  36. data/spec/controllers/spotlight/contacts_controller_spec.rb +8 -8
  37. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +5 -5
  38. data/spec/controllers/spotlight/dashboards_controller_spec.rb +5 -5
  39. data/spec/controllers/spotlight/exhibits_controller_spec.rb +26 -20
  40. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +18 -18
  41. data/spec/controllers/spotlight/filters_controller_spec.rb +6 -6
  42. data/spec/controllers/spotlight/home_pages_controller_spec.rb +9 -9
  43. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +15 -12
  44. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +5 -5
  45. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +4 -4
  46. data/spec/controllers/spotlight/resources_controller_spec.rb +8 -8
  47. data/spec/controllers/spotlight/roles_controller_spec.rb +47 -29
  48. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +35 -23
  49. data/spec/controllers/spotlight/searches_controller_spec.rb +33 -22
  50. data/spec/controllers/spotlight/sites_controller_spec.rb +2 -2
  51. data/spec/controllers/spotlight/solr_controller_spec.rb +29 -17
  52. data/spec/controllers/spotlight/tags_controller_spec.rb +4 -4
  53. data/spec/controllers/spotlight/versions_controller_spec.rb +3 -3
  54. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +2 -2
  55. data/spec/features/add_items_spec.rb +23 -2
  56. data/spec/fixtures/json-upload-fixture.json +3 -0
  57. data/spec/spec_helper.rb +2 -0
  58. data/spec/support/backport_test_helpers.rb +45 -0
  59. metadata +9 -2
@@ -528,6 +528,11 @@ en:
528
528
  help_html: "%{link}"
529
529
  template: "Download template"
530
530
  file_label: "CSV File"
531
+ json_upload:
532
+ form:
533
+ title: "Upload raw documents"
534
+ add_item: "Add item"
535
+ file_label: "JSON File"
531
536
  bookmarklet:
532
537
  instructions: "Drag this button to the bookmarks toolbar in your web browser"
533
538
  bookmarklet: "%{application_name} widget"
@@ -18,6 +18,8 @@ module Spotlight
18
18
 
19
19
  def friendly_id
20
20
  gem 'friendly_id', github: 'norman/friendly_id'
21
+ # we need to immediately run `bundle install` while pointing at github.
22
+ Bundler.with_clean_env { run 'bundle install' }
21
23
  generate 'friendly_id'
22
24
  end
23
25
 
@@ -0,0 +1,58 @@
1
+ # ==> User model
2
+ # Note that your chosen model must include Spotlight::User mixin
3
+ # Spotlight::Engine.config.user_class = '::User'
4
+
5
+ # ==> Blacklight configuration
6
+ # Spotlight uses this upstream configuration to populate settings for the curator
7
+ # Spotlight::Engine.config.catalog_controller_class = '::CatalogController'
8
+ # Spotlight::Engine.config.default_blacklight_config = nil
9
+
10
+ # ==> Appearance configuration
11
+ # Spotlight::Engine.config.exhibit_main_navigation = [:curated_features, :browse, :about]
12
+ # Spotlight::Engine.config.resource_partials = [
13
+ # 'spotlight/resources/external_resources_form',
14
+ # 'spotlight/resources/upload/form',
15
+ # 'spotlight/resources/csv_upload/form',
16
+ # 'spotlight/resources/json_upload/form'
17
+ # ]
18
+ # Spotlight::Engine.config.external_resources_partials = []
19
+ # Spotlight::Engine.config.default_browse_index_view_type = :gallery
20
+ # Spotlight::Engine.config.default_contact_email = nil
21
+
22
+ # ==> Solr configuration
23
+ # Spotlight::Engine.config.writable_index = true
24
+ # Spotlight::Engine.config.solr_batch_size = 20
25
+ # Spotlight::Engine.config.filter_resources_by_exhibit = true
26
+ # Spotlight::Engine.config.autocomplete_search_field = 'autocomplete'
27
+ # Spotlight::Engine.config.default_autocomplete_params = { qf: 'id^1000 full_title_tesim^100 id_ng full_title_ng' }
28
+
29
+ # Solr field configurations
30
+ # Spotlight::Engine.config.solr_fields.prefix = ''.freeze
31
+ # Spotlight::Engine.config.solr_fields.boolean_suffix = '_bsi'.freeze
32
+ # Spotlight::Engine.config.solr_fields.string_suffix = '_ssim'.freeze
33
+ # Spotlight::Engine.config.solr_fields.text_suffix = '_tesim'.freeze
34
+ # Spotlight::Engine.config.resource_global_id_field = :"#{config.solr_fields.prefix}spotlight_resource_id#{config.solr_fields.string_suffix}"
35
+ # Spotlight::Engine.config.full_image_field = :full_image_url_ssm
36
+ # Spotlight::Engine.config.thumbnail_field = :thumbnail_url_ssm
37
+ # Spotlight::Engine.config.square_image_field = :thumbnail_square_url_ssm
38
+
39
+ # ==> Uploaded item configuration
40
+ # Spotlight::Engine.config.upload_fields = [
41
+ # OpenStruct.new(field_name: :spotlight_upload_description_tesim, label: 'Description', form_field_type: :text_area),
42
+ # OpenStruct.new(field_name: :spotlight_upload_attribution_tesim, label: 'Attribution'),
43
+ # OpenStruct.new(field_name: :spotlight_upload_date_tesim, label: 'Date')
44
+ # ]
45
+ # Spotlight::Engine.config.upload_title_field = nil # OpenStruct.new(...)
46
+ # Spotlight::Engine.config.uploader_storage = :file
47
+ # Spotlight::Engine.config.allowed_upload_extensions = %w(jpg jpeg png)
48
+
49
+ # Spotlight::Engine.config.featured_image_thumb_size = [400, 300]
50
+ # Spotlight::Engine.config.featured_image_square_size = [400, 400]
51
+
52
+ # ==> Google Analytics integration
53
+ # Spotlight::Engine.config.analytics_provider = nil
54
+ # Spotlight::Engine.config.ga_pkcs12_key_path = nil
55
+ # Spotlight::Engine.config.ga_web_property_id = nil
56
+ # Spotlight::Engine.config.ga_email = nil
57
+ # Spotlight::Engine.config.ga_analytics_options = {}
58
+ # Spotlight::Engine.config.ga_page_analytics_options = config.ga_analytics_options.merge(limit: 5)
@@ -80,7 +80,12 @@ module Spotlight
80
80
 
81
81
  config.exhibit_main_navigation = [:curated_features, :browse, :about]
82
82
 
83
- config.resource_partials = ['spotlight/resources/external_resources_form', 'spotlight/resources/upload/form', 'spotlight/resources/csv_upload/form']
83
+ config.resource_partials = [
84
+ 'spotlight/resources/external_resources_form',
85
+ 'spotlight/resources/upload/form',
86
+ 'spotlight/resources/csv_upload/form',
87
+ 'spotlight/resources/json_upload/form'
88
+ ]
84
89
  config.external_resources_partials = []
85
90
  config.solr_batch_size = 20
86
91
 
@@ -1,3 +1,3 @@
1
1
  module Spotlight
2
- VERSION = '0.23.0'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  end
@@ -6,7 +6,7 @@ describe Spotlight::AboutPagesController, type: :controller do
6
6
  describe 'POST update_all' do
7
7
  let(:exhibit) { FactoryGirl.create(:exhibit) }
8
8
  it 'is not allowed' do
9
- post :update_all, exhibit_id: exhibit
9
+ post :update_all, params: { exhibit_id: exhibit }
10
10
  expect(response).to redirect_to main_app.new_user_session_path
11
11
  end
12
12
  end
@@ -24,7 +24,7 @@ describe Spotlight::AboutPagesController, type: :controller do
24
24
  it 'is successful' do
25
25
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
26
26
  expect(controller).to receive(:add_breadcrumb).with('About', [exhibit, page])
27
- get :show, id: page, exhibit_id: exhibit
27
+ get :show, params: { id: page, exhibit_id: exhibit }
28
28
  expect(assigns(:page)).to eq page
29
29
  expect(assigns(:exhibit)).to eq exhibit
30
30
  end
@@ -34,7 +34,7 @@ describe Spotlight::AboutPagesController, type: :controller do
34
34
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
35
35
  expect(controller).to receive(:add_breadcrumb).with('About', [exhibit, page])
36
36
  expect(controller).to receive(:add_breadcrumb).with(page2.title, [exhibit, page2])
37
- get :show, id: page2, exhibit_id: exhibit
37
+ get :show, params: { id: page2, exhibit_id: exhibit }
38
38
  expect(assigns(:page)).to eq page2
39
39
  expect(assigns(:exhibit)).to eq exhibit
40
40
  end
@@ -48,7 +48,7 @@ describe Spotlight::AboutPagesController, type: :controller do
48
48
  it 'is successful' do
49
49
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
50
50
  expect(controller).to receive(:add_breadcrumb).with('About Pages', exhibit_about_pages_path(exhibit))
51
- get :edit, id: page, exhibit_id: exhibit
51
+ get :edit, params: { id: page, exhibit_id: exhibit }
52
52
  expect(assigns(:page)).to eq page
53
53
  expect(assigns(:exhibit)).to eq exhibit
54
54
  end
@@ -58,7 +58,7 @@ describe Spotlight::AboutPagesController, type: :controller do
58
58
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
59
59
  expect(controller).to receive(:add_breadcrumb).with('About Pages', exhibit_about_pages_path(exhibit))
60
60
  expect(controller).to receive(:add_breadcrumb).with(page2.title, [:edit, exhibit, page2])
61
- get :edit, id: page2, exhibit_id: exhibit
61
+ get :edit, params: { id: page2, exhibit_id: exhibit }
62
62
  expect(assigns(:page)).to eq page2
63
63
  expect(assigns(:exhibit)).to eq exhibit
64
64
  end
@@ -71,7 +71,7 @@ describe Spotlight::AboutPagesController, type: :controller do
71
71
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
72
72
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
73
73
  expect(controller).to receive(:add_breadcrumb).with('About Pages', exhibit_about_pages_path(exhibit))
74
- get :index, exhibit_id: exhibit
74
+ get :index, params: { exhibit_id: exhibit }
75
75
  expect(assigns(:page)).to be_kind_of Spotlight::Page
76
76
  expect(assigns(:page)).to be_new_record
77
77
  expect(assigns(:pages)).to include page
@@ -80,14 +80,14 @@ describe Spotlight::AboutPagesController, type: :controller do
80
80
  end
81
81
  describe 'POST create' do
82
82
  it 'redirects to the about page index' do
83
- post :create, about_page: { title: 'MyString' }, exhibit_id: exhibit
83
+ post :create, params: { about_page: { title: 'MyString' }, exhibit_id: exhibit }
84
84
  expect(response).to redirect_to(exhibit_about_pages_path(exhibit))
85
85
  end
86
86
  end
87
87
  describe 'PUT update' do
88
88
  let!(:page) { FactoryGirl.create(:about_page, exhibit: exhibit) }
89
89
  it 'redirects to the about page' do
90
- put :update, id: page, exhibit_id: page.exhibit.id, about_page: valid_attributes
90
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, about_page: valid_attributes }
91
91
  page.reload
92
92
  expect(response).to redirect_to(exhibit_about_page_path(page.exhibit, page))
93
93
  expect(flash[:notice]).to have_link 'Undo changes'
@@ -99,11 +99,14 @@ describe Spotlight::AboutPagesController, type: :controller do
99
99
  let!(:page3) { FactoryGirl.create(:about_page, exhibit: exhibit, published: true) }
100
100
  before { request.env['HTTP_REFERER'] = 'http://example.com' }
101
101
  it 'updates whether they are on the landing page' do
102
- post :update_all, exhibit_id: page1.exhibit, exhibit: {
103
- about_pages_attributes: [
104
- { id: page1.id, published: true, title: 'This is a new title!' },
105
- { id: page2.id, published: false }
106
- ]
102
+ post :update_all, params: {
103
+ exhibit_id: page1.exhibit,
104
+ exhibit: {
105
+ about_pages_attributes: [
106
+ { id: page1.id, published: true, title: 'This is a new title!' },
107
+ { id: page2.id, published: false }
108
+ ]
109
+ }
107
110
  }
108
111
  expect(response).to redirect_to 'http://example.com'
109
112
  expect(flash[:notice]).to eq 'About pages were successfully updated.'
@@ -118,10 +121,15 @@ describe Spotlight::AboutPagesController, type: :controller do
118
121
  let!(:contact1) { FactoryGirl.create(:contact, name: 'Aphra Behn', exhibit: exhibit) }
119
122
  let!(:contact2) { FactoryGirl.create(:contact, exhibit: exhibit) }
120
123
  it 'updates contacts' do
121
- patch :update_contacts, exhibit_id: exhibit, exhibit: { contacts_attributes: [
122
- { 'show_in_sidebar' => '1', 'id' => contact1.id, weight: 1 },
123
- { 'show_in_sidebar' => '0', 'id' => contact2.id, weight: 2 }
124
- ] }
124
+ patch :update_contacts, params: {
125
+ exhibit_id: exhibit,
126
+ exhibit: {
127
+ contacts_attributes: [
128
+ { 'show_in_sidebar' => '1', 'id' => contact1.id, weight: 1 },
129
+ { 'show_in_sidebar' => '0', 'id' => contact2.id, weight: 2 }
130
+ ]
131
+ }
132
+ }
125
133
  expect(response).to redirect_to exhibit_about_pages_path(exhibit)
126
134
  expect(flash[:notice]).to eq 'Contacts were successfully updated.'
127
135
  expect(exhibit.contacts.size).to eq 2
@@ -131,11 +139,14 @@ describe Spotlight::AboutPagesController, type: :controller do
131
139
  end
132
140
  it 'shows index on failure' do
133
141
  expect_any_instance_of(Spotlight::Exhibit).to receive(:update).and_return(false)
134
- patch :update_contacts, exhibit_id: exhibit, exhibit: { contacts_attributes: [
135
- { 'show_in_sidebar' => '1', 'name' => 'Justin Coyne', 'email' => 'jcoyne@justincoyne.com', 'title' => '', 'location' => 'US' },
136
- { 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => '', 'location' => '' },
137
- { 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => 'Librarian', 'location' => '' }
138
- ] }
142
+ patch :update_contacts, params: {
143
+ exhibit_id: exhibit,
144
+ exhibit: { contacts_attributes: [
145
+ { 'show_in_sidebar' => '1', 'name' => 'Justin Coyne', 'email' => 'jcoyne@justincoyne.com', 'title' => '', 'location' => 'US' },
146
+ { 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => '', 'location' => '' },
147
+ { 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => 'Librarian', 'location' => '' }
148
+ ] }
149
+ }
139
150
  expect(response).to render_template('index')
140
151
  end
141
152
  end
@@ -23,13 +23,13 @@ describe Spotlight::AdminUsersController, type: :controller do
23
23
 
24
24
  describe 'DELETE destroy' do
25
25
  before do
26
- post :invite, user: 'user@example.com', role: 'admin'
26
+ post :invite, params: { user: 'user@example.com', role: 'admin' }
27
27
  end
28
28
  it 'removes the site admin role from the given user' do
29
29
  last_user = Spotlight::Site.instance.roles.last.user
30
30
  expect(last_user.email).to eq 'user@example.com'
31
31
 
32
- delete :destroy, id: last_user.id
32
+ delete :destroy, params: { id: last_user.id }
33
33
  expect(response).to redirect_to(admin_users_path)
34
34
  expect(flash[:notice]).to eq 'User removed from site adminstrator role'
35
35
  expect(Spotlight::Site.instance.roles.last.user.id).not_to eq last_user.id
@@ -45,12 +45,12 @@ describe Spotlight::AdminUsersController, type: :controller do
45
45
 
46
46
  it 'returns a successful status when the requested user exists' do
47
47
  user = FactoryGirl.create(:exhibit_curator)
48
- get :exists, user: user.email
48
+ get :exists, params: { user: user.email }
49
49
  expect(response).to be_success
50
50
  end
51
51
 
52
52
  it 'returns an unsuccessful status when the user does not exist' do
53
- get :exists, user: 'user@example.com'
53
+ get :exists, params: { user: 'user@example.com' }
54
54
  expect(response).not_to be_success
55
55
  expect(response.status).to eq 404
56
56
  end
@@ -59,22 +59,22 @@ describe Spotlight::AdminUsersController, type: :controller do
59
59
  describe 'GET invite' do
60
60
  it 'invites the selected user to be an admin' do
61
61
  expect do
62
- post :invite, user: 'user@example.com', role: 'admin'
62
+ post :invite, params: { user: 'user@example.com', role: 'admin' }
63
63
  end.to change { Spotlight::Engine.user_class.count }.by(1)
64
64
  expect(Spotlight::Engine.user_class.last.roles.length).to eq 1
65
65
  expect(Spotlight::Engine.user_class.last.roles.first.resource).to eq Spotlight::Site.instance
66
66
  end
67
67
 
68
68
  it 'redirects back with a flash notice upon success' do
69
- post :invite, user: 'user@example.com', role: 'admin'
69
+ post :invite, params: { user: 'user@example.com', role: 'admin' }
70
70
  expect(flash[:notice]).to eq 'User has been invited.'
71
- expect(response).to redirect_to(:back)
71
+ expect(response).to redirect_to('http://example.com')
72
72
  end
73
73
 
74
74
  it 'redirects back with flash error upon failure' do
75
- post :invite, user: 'user@example.com', role: 'not-a-real-role'
75
+ post :invite, params: { user: 'user@example.com', role: 'not-a-real-role' }
76
76
  expect(flash[:alert]).to eq 'There was a problem saving the user.'
77
- expect(response).to redirect_to(:back)
77
+ expect(response).to redirect_to('http://example.com')
78
78
  end
79
79
  end
80
80
  end
@@ -9,7 +9,7 @@ describe Spotlight::AppearancesController, type: :controller do
9
9
 
10
10
  describe 'GET edit' do
11
11
  it 'denies access' do
12
- get :edit, exhibit_id: exhibit
12
+ get :edit, params: { exhibit_id: exhibit }
13
13
  expect(response).to redirect_to main_app.root_path
14
14
  expect(flash[:alert]).to be_present
15
15
  end
@@ -19,7 +19,7 @@ describe Spotlight::AppearancesController, type: :controller do
19
19
  describe 'when not logged in' do
20
20
  describe 'PATCH update' do
21
21
  it 'is not allowed' do
22
- patch :update, exhibit_id: exhibit
22
+ patch :update, params: { exhibit_id: exhibit }
23
23
  expect(response).to redirect_to main_app.new_user_session_path
24
24
  end
25
25
  end
@@ -34,7 +34,7 @@ describe Spotlight::AppearancesController, type: :controller do
34
34
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
35
35
  expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
36
36
  expect(controller).to receive(:add_breadcrumb).with('Appearance', edit_exhibit_appearance_path(exhibit))
37
- get :edit, exhibit_id: exhibit
37
+ get :edit, params: { exhibit_id: exhibit }
38
38
  expect(response).to be_successful
39
39
  expect(assigns[:exhibit]).to be_kind_of Spotlight::Exhibit
40
40
  end
@@ -55,11 +55,14 @@ describe Spotlight::AppearancesController, type: :controller do
55
55
  }
56
56
  }
57
57
  else
58
- patch :update, exhibit_id: exhibit, exhibit: {
59
- main_navigations_attributes: [
60
- { id: first_nav.id, label: 'Some Label', weight: 500 },
61
- { id: last_nav.id, display: false }
62
- ]
58
+ patch :update, params: {
59
+ exhibit_id: exhibit,
60
+ exhibit: {
61
+ main_navigations_attributes: [
62
+ { id: first_nav.id, label: 'Some Label', weight: 500 },
63
+ { id: last_nav.id, display: false }
64
+ ]
65
+ }
63
66
  }
64
67
  end
65
68
  expect(flash[:notice]).to eq 'The exhibit was successfully updated.'
@@ -4,7 +4,7 @@ describe Spotlight::AttachmentsController, type: :controller do
4
4
  describe 'when not logged in' do
5
5
  describe 'GET edit' do
6
6
  it 'is successful' do
7
- post :create, exhibit_id: exhibit
7
+ post :create, params: { exhibit_id: exhibit }
8
8
  expect(response).to redirect_to main_app.new_user_session_path
9
9
  end
10
10
  end
@@ -16,7 +16,7 @@ describe Spotlight::AttachmentsController, type: :controller do
16
16
 
17
17
  describe 'POST create' do
18
18
  it 'is successful' do
19
- post :create, exhibit_id: exhibit, attachment: { name: 'xyz' }
19
+ post :create, params: { exhibit_id: exhibit, attachment: { name: 'xyz' } }
20
20
  expect(response).to be_successful
21
21
  end
22
22
  end
@@ -11,7 +11,7 @@ describe Spotlight::BrowseController, type: :controller do
11
11
  it 'does not show unpublished categories' do
12
12
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
13
13
  expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
14
- get :index, exhibit_id: exhibit
14
+ get :index, params: { exhibit_id: exhibit }
15
15
  expect(response).to be_successful
16
16
  expect(assigns[:searches]).to eq [search]
17
17
  expect(assigns[:searches]).to_not include unpublished
@@ -26,7 +26,7 @@ describe Spotlight::BrowseController, type: :controller do
26
26
  it 'shows the list of browse categories' do
27
27
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
28
28
  expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
29
- get :index, exhibit_id: exhibit
29
+ get :index, params: { exhibit_id: exhibit }
30
30
  expect(response).to be_successful
31
31
  expect(assigns[:searches]).to eq [search]
32
32
  expect(assigns[:searches]).to_not include unpublished
@@ -45,7 +45,7 @@ describe Spotlight::BrowseController, type: :controller do
45
45
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
46
46
  expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
47
47
  expect(controller).to receive(:add_breadcrumb).with(search.title, exhibit_browse_path(exhibit, search))
48
- get :show, id: search, exhibit_id: exhibit
48
+ get :show, params: { id: search, exhibit_id: exhibit }
49
49
  expect(response).to be_successful
50
50
  expect(assigns[:search]).to be_a Spotlight::Search
51
51
  expect(assigns[:response]).to eq mock_response
@@ -54,7 +54,7 @@ describe Spotlight::BrowseController, type: :controller do
54
54
  end
55
55
 
56
56
  it 'removes all the document actions' do
57
- get :show, id: search, exhibit_id: exhibit
57
+ get :show, params: { id: search, exhibit_id: exhibit }
58
58
  expect(controller.blacklight_config.index.document_actions).to be_blank
59
59
  end
60
60
 
@@ -65,7 +65,7 @@ describe Spotlight::BrowseController, type: :controller do
65
65
 
66
66
  allow(controller). to receive(:blacklight_config).and_return(config)
67
67
 
68
- get :show, id: search, exhibit_id: exhibit
68
+ get :show, params: { id: search, exhibit_id: exhibit }
69
69
  expect(controller.blacklight_config.index.document_actions).to match_array [:a, :b, :c]
70
70
  end
71
71
  end
@@ -9,14 +9,14 @@ describe Spotlight::CatalogController, type: :controller do
9
9
  describe 'when the user is not authenticated' do
10
10
  describe 'GET admin' do
11
11
  it 'redirects to the login page' do
12
- get :admin, exhibit_id: exhibit
12
+ get :admin, params: { exhibit_id: exhibit }
13
13
  expect(response).to redirect_to main_app.new_user_session_path
14
14
  end
15
15
  end
16
16
 
17
17
  describe 'GET edit' do
18
18
  it 'is not allowed' do
19
- get :edit, exhibit_id: exhibit, id: 'dq287tq6352'
19
+ get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
20
20
  expect(response).to redirect_to main_app.new_user_session_path
21
21
  end
22
22
  end
@@ -27,7 +27,7 @@ describe Spotlight::CatalogController, type: :controller do
27
27
  it 'shows the item' do
28
28
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit, q: ''))
29
29
  expect(controller).to receive(:add_breadcrumb).with("L'AMERIQUE", exhibit_solr_document_path(exhibit, document))
30
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
30
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
31
31
  expect(response).to be_successful
32
32
  end
33
33
 
@@ -38,7 +38,7 @@ describe Spotlight::CatalogController, type: :controller do
38
38
  expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
39
39
  expect(controller).to receive(:add_breadcrumb).with(search.title, exhibit_browse_path(exhibit, search))
40
40
  expect(controller).to receive(:add_breadcrumb).with("L'AMERIQUE", exhibit_solr_document_path(exhibit, document))
41
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
41
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
42
42
  expect(response).to be_successful
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ describe Spotlight::CatalogController, type: :controller do
49
49
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit, q: ''))
50
50
  expect(controller).to receive(:add_breadcrumb).with(feature_page.title, [exhibit, feature_page])
51
51
  expect(controller).to receive(:add_breadcrumb).with("L'AMERIQUE", exhibit_solr_document_path(exhibit, document))
52
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
52
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
53
53
  expect(response).to be_successful
54
54
  end
55
55
 
@@ -59,17 +59,17 @@ describe Spotlight::CatalogController, type: :controller do
59
59
 
60
60
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit, q: ''))
61
61
  expect(controller).to receive(:add_breadcrumb).with("L'AMERIQUE", exhibit_solr_document_path(exhibit, document))
62
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
62
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
63
63
  expect(response).to be_successful
64
64
  end
65
65
 
66
66
  it 'adds the curation widget' do
67
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
67
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
68
68
  expect(controller.blacklight_config.show.partials.first).to eq 'curation_mode_toggle'
69
69
  end
70
70
 
71
71
  it 'does not have a solr_json serialization' do
72
- get :show, exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json
72
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json }
73
73
  expect(response).not_to be_successful
74
74
  end
75
75
  end
@@ -78,11 +78,11 @@ describe Spotlight::CatalogController, type: :controller do
78
78
  it 'shows the index when there are parameters' do
79
79
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit, q: ''))
80
80
  expect(controller).to receive(:add_breadcrumb).with('Search Results', search_exhibit_catalog_path(exhibit, q: 'map'))
81
- get :index, exhibit_id: exhibit, q: 'map'
81
+ get :index, params: { exhibit_id: exhibit, q: 'map' }
82
82
  expect(response).to be_successful
83
83
  end
84
84
  it 'redirects to the exhibit home page when there are no parameters' do
85
- get :index, exhibit_id: exhibit
85
+ get :index, params: { exhibit_id: exhibit }
86
86
  expect(response).to redirect_to(exhibit_root_path(exhibit))
87
87
  end
88
88
  end
@@ -90,7 +90,7 @@ describe Spotlight::CatalogController, type: :controller do
90
90
  describe 'GET autocomplete' do
91
91
  it 'has partial matches for title' do
92
92
  # Testing with ps921pn8250 because it has html escapable characters in the title (c'estadire)
93
- get :autocomplete, exhibit_id: exhibit, q: 'PLANIS', format: 'json'
93
+ get :autocomplete, params: { exhibit_id: exhibit, q: 'PLANIS', format: 'json' }
94
94
  expect(assigns[:document_list].first.id).to eq 'ps921pn8250'
95
95
  expect(response).to be_successful
96
96
  json = JSON.parse(response.body)
@@ -103,7 +103,7 @@ describe Spotlight::CatalogController, type: :controller do
103
103
  expect(doc['url']).to eq exhibit_solr_document_path(exhibit, id: 'ps921pn8250')
104
104
  end
105
105
  it 'has partial matches for id' do
106
- get :autocomplete, exhibit_id: exhibit, q: 'dx157', format: 'json'
106
+ get :autocomplete, params: { exhibit_id: exhibit, q: 'dx157', format: 'json' }
107
107
  expect(assigns[:document_list].first.id).to eq 'dx157dh4345'
108
108
  expect(response).to be_successful
109
109
  json = JSON.parse(response.body)
@@ -120,7 +120,7 @@ describe Spotlight::CatalogController, type: :controller do
120
120
 
121
121
  describe 'GET admin' do
122
122
  it 'denies access' do
123
- get :admin, exhibit_id: exhibit
123
+ get :admin, params: { exhibit_id: exhibit }
124
124
  expect(response).to redirect_to main_app.root_path
125
125
  expect(flash[:alert]).to be_present
126
126
  end
@@ -128,7 +128,7 @@ describe Spotlight::CatalogController, type: :controller do
128
128
 
129
129
  describe 'GET edit' do
130
130
  it 'is not allowed' do
131
- get :edit, exhibit_id: exhibit, id: 'dq287tq6352'
131
+ get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
132
132
  expect(response).to redirect_to main_app.root_path
133
133
  expect(flash[:alert]).to eq 'You are not authorized to access this page.'
134
134
  end
@@ -137,7 +137,7 @@ describe Spotlight::CatalogController, type: :controller do
137
137
  describe 'GET show with private item' do
138
138
  it 'is not allowed' do
139
139
  allow_any_instance_of(::SolrDocument).to receive(:private?).and_return(true)
140
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
140
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
141
141
  expect(response).to redirect_to main_app.root_path
142
142
  expect(flash[:alert]).to eq 'You are not authorized to access this page.'
143
143
  end
@@ -145,7 +145,7 @@ describe Spotlight::CatalogController, type: :controller do
145
145
 
146
146
  describe 'PUT make_public' do
147
147
  it 'is not allowed' do
148
- put :make_public, exhibit_id: exhibit, id: 'dq287tq6352'
148
+ put :make_public, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
149
149
 
150
150
  expect(response).to redirect_to main_app.root_path
151
151
  expect(flash[:alert]).to eq 'You are not authorized to access this page.'
@@ -154,7 +154,7 @@ describe Spotlight::CatalogController, type: :controller do
154
154
 
155
155
  describe 'DELETE make_private' do
156
156
  it 'is not allowed' do
157
- delete :make_private, exhibit_id: exhibit, id: 'dq287tq6352'
157
+ delete :make_private, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
158
158
  expect(response).to redirect_to main_app.root_path
159
159
  expect(flash[:alert]).to eq 'You are not authorized to access this page.'
160
160
  end
@@ -168,7 +168,7 @@ describe Spotlight::CatalogController, type: :controller do
168
168
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit, q: ''))
169
169
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
170
170
  expect(controller).to receive(:add_breadcrumb).with('Items', admin_exhibit_catalog_path(exhibit))
171
- get :admin, exhibit_id: exhibit
171
+ get :admin, params: { exhibit_id: exhibit }
172
172
  expect(response).to be_successful
173
173
  expect(assigns[:document_list]).to be_a Array
174
174
  expect(assigns[:exhibit]).to eq exhibit
@@ -177,7 +177,7 @@ describe Spotlight::CatalogController, type: :controller do
177
177
  end
178
178
 
179
179
  it 'uses the admin table view and hide the document actions' do
180
- get :admin, exhibit_id: exhibit
180
+ get :admin, params: { exhibit_id: exhibit }
181
181
 
182
182
  expect(controller.blacklight_config.view.to_h.keys).to match_array [:admin_table]
183
183
  expect(controller.blacklight_config.view.admin_table.document_actions).to be_empty
@@ -185,7 +185,7 @@ describe Spotlight::CatalogController, type: :controller do
185
185
 
186
186
  describe 'GET edit' do
187
187
  it 'is successful' do
188
- get :edit, exhibit_id: exhibit, id: 'dq287tq6352'
188
+ get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
189
189
  expect(response).to be_successful
190
190
  expect(assigns[:exhibit]).to eq exhibit
191
191
  expect(assigns[:document]).to be_kind_of SolrDocument
@@ -194,17 +194,17 @@ describe Spotlight::CatalogController, type: :controller do
194
194
  describe 'PATCH update' do
195
195
  it 'is successful' do
196
196
  expect do
197
- patch :update, exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { exhibit_tag_list: 'one, two' }
197
+ patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { exhibit_tag_list: 'one, two' } }
198
198
  end.to change { exhibit.owned_taggings.count }.by(2)
199
199
  end
200
200
  it 'can update non-readonly fields' do
201
201
  field = FactoryGirl.create(:custom_field, exhibit: exhibit)
202
- patch :update, exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } }
202
+ patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } } }
203
203
  expect(assigns[:document].sidecar(exhibit).data).to eq(field.field => 'no')
204
204
  end
205
205
  it "can't update readonly fields" do
206
206
  field = FactoryGirl.create(:custom_field, exhibit: exhibit, readonly_field: true)
207
- patch :update, exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } }
207
+ patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } } }
208
208
  expect(assigns[:document].sidecar(exhibit).data).to eq({})
209
209
  end
210
210
  end
@@ -218,7 +218,7 @@ describe Spotlight::CatalogController, type: :controller do
218
218
  it 'is successful' do
219
219
  expect_any_instance_of(::SolrDocument).to receive(:reindex)
220
220
  expect_any_instance_of(::SolrDocument).to receive(:make_public!).with(exhibit)
221
- put :make_public, exhibit_id: exhibit, id: 'dq287tq6352'
221
+ put :make_public, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
222
222
  expect(response).to redirect_to 'where_i_came_from'
223
223
  end
224
224
  end
@@ -232,7 +232,7 @@ describe Spotlight::CatalogController, type: :controller do
232
232
  it 'is successful' do
233
233
  expect_any_instance_of(::SolrDocument).to receive(:reindex)
234
234
  expect_any_instance_of(::SolrDocument).to receive(:make_private!).with(exhibit)
235
- delete :make_private, exhibit_id: exhibit, id: 'dq287tq6352'
235
+ delete :make_private, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
236
236
  expect(response).to redirect_to 'where_i_came_from'
237
237
  end
238
238
  end
@@ -243,7 +243,7 @@ describe Spotlight::CatalogController, type: :controller do
243
243
 
244
244
  describe 'GET show' do
245
245
  it 'has a solr_json serialization' do
246
- get :show, exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json
246
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json }
247
247
  expect(response).to be_successful
248
248
  data = JSON.parse(response.body).with_indifferent_access
249
249
  expect(data).to include id: 'dq287tq6352'
@@ -278,7 +278,7 @@ describe Spotlight::CatalogController, type: :controller do
278
278
  end
279
279
 
280
280
  it 'preserves query parameters' do
281
- get :index, q: 'xyz', exhibit_id: exhibit
281
+ get :index, params: { q: 'xyz', exhibit_id: exhibit }
282
282
  url = subject.exhibit_search_facet_url(id: 'x')
283
283
  expect(url).to include '?q=xyz'
284
284
  end
@@ -310,7 +310,7 @@ describe Spotlight::CatalogController, type: :controller do
310
310
  end
311
311
 
312
312
  it 'uses the saved search context' do
313
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
313
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
314
314
 
315
315
  expect(assigns(:previous_document)).to eq first_doc
316
316
  expect(assigns(:next_document)).to eq last_doc
@@ -323,7 +323,7 @@ describe Spotlight::CatalogController, type: :controller do
323
323
  end
324
324
 
325
325
  it 'ignores the search context' do
326
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
326
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
327
327
 
328
328
  expect(assigns(:previous_document)).to be_nil
329
329
  expect(assigns(:next_document)).to be_nil
@@ -344,7 +344,7 @@ describe Spotlight::CatalogController, type: :controller do
344
344
 
345
345
  it 'uses the page context' do
346
346
  pending 'Waiting to figure out how to construct previous/next documents'
347
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
347
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
348
348
 
349
349
  expect(assigns(:previous_document)).to be_a_kind_of SolrDocument
350
350
  expect(assigns(:next_document)).to be_a_kind_of SolrDocument
@@ -357,7 +357,7 @@ describe Spotlight::CatalogController, type: :controller do
357
357
  end
358
358
 
359
359
  it 'ignores the search context' do
360
- get :show, exhibit_id: exhibit, id: 'dq287tq6352'
360
+ get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
361
361
 
362
362
  expect(assigns(:previous_document)).to be_nil
363
363
  expect(assigns(:next_document)).to be_nil