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
@@ -25,7 +25,7 @@ describe Spotlight::ConfirmationsController, type: :controller do
25
25
  end
26
26
  describe 'when the token is valid' do
27
27
  it 'updates the user' do
28
- get :show, confirmation_token: raw_token
28
+ get :show, params: { confirmation_token: raw_token }
29
29
  expect(contact_email.reload).to be_confirmed
30
30
  expect(response).to redirect_to main_app.new_user_session_path
31
31
  end
@@ -16,15 +16,15 @@ describe Spotlight::ContactFormsController, type: :controller do
16
16
  describe 'POST create' do
17
17
  it 'sends an email' do
18
18
  expect do
19
- post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
19
+ post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' } }
20
20
  end.to change { ActionMailer::Base.deliveries.count }.by(1)
21
21
  end
22
22
  it 'redirects back' do
23
- post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
24
- expect(response).to redirect_to :back
23
+ post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' } }
24
+ expect(response).to redirect_to 'http://example.com'
25
25
  end
26
26
  it 'sets a flash message' do
27
- post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
27
+ post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' } }
28
28
  expect(flash[:notice]).to eq 'Thanks. Your feedback has been sent.'
29
29
  end
30
30
  end
@@ -4,7 +4,7 @@ describe Spotlight::ContactsController, type: :controller do
4
4
  describe 'GET edit' do
5
5
  let(:contact) { FactoryGirl.create(:contact) }
6
6
  it 'is successful' do
7
- get :edit, id: contact, exhibit_id: contact.exhibit
7
+ get :edit, params: { id: contact, exhibit_id: contact.exhibit }
8
8
  expect(response).to redirect_to main_app.new_user_session_path
9
9
  end
10
10
  end
@@ -22,19 +22,19 @@ describe Spotlight::ContactsController, type: :controller do
22
22
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
23
23
  expect(controller).to receive(:add_breadcrumb).with('About Pages', exhibit_about_pages_path(exhibit))
24
24
  expect(controller).to receive(:add_breadcrumb).with(contact.name, edit_exhibit_contact_path(exhibit, contact))
25
- get :edit, id: contact, exhibit_id: contact.exhibit
25
+ get :edit, params: { id: contact, exhibit_id: contact.exhibit }
26
26
  expect(response).to be_successful
27
27
  end
28
28
  end
29
29
  describe 'PATCH update' do
30
30
  it 'is successful' do
31
- patch :update, id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit
31
+ patch :update, params: { id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit }
32
32
  expect(response).to redirect_to exhibit_about_pages_path(exhibit)
33
33
  expect(contact.reload.name).to eq 'Chester'
34
34
  end
35
35
  it 'fails by rendering edit' do
36
36
  expect_any_instance_of(Spotlight::Contact).to receive(:update).and_return(false)
37
- patch :update, id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit
37
+ patch :update, params: { id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit }
38
38
  expect(response).to render_template 'edit'
39
39
  end
40
40
  end
@@ -42,7 +42,7 @@ describe Spotlight::ContactsController, type: :controller do
42
42
  it 'is successful' do
43
43
  contact # force contact to be created
44
44
  expect do
45
- delete :destroy, id: contact, exhibit_id: contact.exhibit
45
+ delete :destroy, params: { id: contact, exhibit_id: contact.exhibit }
46
46
  end.to change { Spotlight::Contact.count }.by(-1)
47
47
  expect(response).to redirect_to exhibit_about_pages_path(exhibit)
48
48
  end
@@ -53,19 +53,19 @@ describe Spotlight::ContactsController, type: :controller do
53
53
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
54
54
  expect(controller).to receive(:add_breadcrumb).with('About Pages', exhibit_about_pages_path(exhibit))
55
55
  expect(controller).to receive(:add_breadcrumb).with('Add contact', new_exhibit_contact_path(exhibit))
56
- get :new, exhibit_id: exhibit
56
+ get :new, params: { exhibit_id: exhibit }
57
57
  expect(response).to be_successful
58
58
  end
59
59
  end
60
60
  describe 'POST create' do
61
61
  it 'fails by rendering new' do
62
62
  expect_any_instance_of(Spotlight::Contact).to receive(:update).and_return(false)
63
- post :create, exhibit_id: exhibit, contact: { name: 'Chester' }
63
+ post :create, params: { exhibit_id: exhibit, contact: { name: 'Chester' } }
64
64
  expect(response).to render_template 'new'
65
65
  end
66
66
  it 'is successful' do
67
67
  expect do
68
- post :create, exhibit_id: exhibit, contact: { name: 'Chester' }
68
+ post :create, params: { exhibit_id: exhibit, contact: { name: 'Chester' } }
69
69
  end.to change { Spotlight::Contact.count }.by(1)
70
70
  expect(response).to redirect_to exhibit_about_pages_path(exhibit)
71
71
  expect(Spotlight::Contact.last.show_in_sidebar).to be_truthy
@@ -12,7 +12,7 @@ describe Spotlight::CustomFieldsController, type: :controller do
12
12
  expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
13
13
  expect(controller).to receive(:add_breadcrumb).with('Metadata', edit_exhibit_metadata_configuration_path(exhibit))
14
14
  expect(controller).to receive(:add_breadcrumb).with('Add new field', new_exhibit_custom_field_path(exhibit))
15
- get :new, exhibit_id: exhibit
15
+ get :new, params: { exhibit_id: exhibit }
16
16
  expect(assigns(:custom_field)).to be_a_new(Spotlight::CustomField)
17
17
  end
18
18
  end
@@ -24,7 +24,7 @@ describe Spotlight::CustomFieldsController, type: :controller do
24
24
  expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
25
25
  expect(controller).to receive(:add_breadcrumb).with('Metadata', edit_exhibit_metadata_configuration_path(exhibit))
26
26
  expect(controller).to receive(:add_breadcrumb).with(field.label, edit_exhibit_custom_field_path(exhibit, field))
27
- get :edit, exhibit_id: exhibit, id: field
27
+ get :edit, params: { exhibit_id: exhibit, id: field }
28
28
  expect(assigns(:custom_field)).to eq field
29
29
  expect(assigns(:exhibit)).to eq exhibit
30
30
  end
@@ -34,12 +34,12 @@ describe Spotlight::CustomFieldsController, type: :controller do
34
34
  describe 'with valid params' do
35
35
  it 'creates a new Page' do
36
36
  expect do
37
- post :create, custom_field: { label: 'MyString' }, exhibit_id: exhibit
37
+ post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
38
38
  end.to change(Spotlight::CustomField, :count).by(1)
39
39
  end
40
40
 
41
41
  it 'redirects to the exhibit metadata page' do
42
- post :create, custom_field: { label: 'MyString' }, exhibit_id: exhibit
42
+ post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
43
43
  expect(response).to redirect_to(edit_exhibit_metadata_configuration_path(exhibit))
44
44
  end
45
45
  end
@@ -48,7 +48,7 @@ describe Spotlight::CustomFieldsController, type: :controller do
48
48
  it "re-renders the 'new' template" do
49
49
  # Trigger the behavior that occurs when invalid params are submitted
50
50
  allow_any_instance_of(Spotlight::CustomField).to receive(:save).and_return(false)
51
- post :create, custom_field: { label: 'MyString' }, exhibit_id: exhibit
51
+ post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
52
52
  expect(assigns(:custom_field)).to be_a_new(Spotlight::CustomField)
53
53
  expect(response).to render_template('new')
54
54
  end
@@ -18,7 +18,7 @@ describe Spotlight::DashboardsController, type: :controller do
18
18
  expect(controller).to receive(:search_results).with(sort: 'timestamp_field desc').and_return([double(:response), [{ id: 1 }]])
19
19
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
20
20
  expect(controller).to receive(:add_breadcrumb).with('Dashboard', exhibit_dashboard_path(exhibit))
21
- get :show, exhibit_id: exhibit.id
21
+ get :show, params: { exhibit_id: exhibit.id }
22
22
  expect(response).to render_template 'spotlight/dashboards/show'
23
23
  expect(assigns[:exhibit]).to eq exhibit
24
24
  expect(assigns[:pages].length).to eq exhibit.pages.length
@@ -30,7 +30,7 @@ describe Spotlight::DashboardsController, type: :controller do
30
30
  it 'loads the exhibit' do
31
31
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
32
32
  expect(controller).to receive(:add_breadcrumb).with('Analytics', analytics_exhibit_dashboard_path(exhibit))
33
- get :analytics, exhibit_id: exhibit.id
33
+ get :analytics, params: { exhibit_id: exhibit.id }
34
34
  expect(response).to render_template 'spotlight/dashboards/analytics'
35
35
  expect(assigns[:exhibit]).to eq exhibit
36
36
  end
@@ -40,12 +40,12 @@ describe Spotlight::DashboardsController, type: :controller do
40
40
  describe 'when user does not have access' do
41
41
  before { sign_in FactoryGirl.create(:exhibit_visitor) }
42
42
  it 'does not allow show' do
43
- get :show, exhibit_id: exhibit.id
43
+ get :show, params: { exhibit_id: exhibit.id }
44
44
  expect(response).to redirect_to main_app.root_path
45
45
  end
46
46
 
47
47
  it 'does not allow analytics' do
48
- get :analytics, exhibit_id: exhibit.id
48
+ get :analytics, params: { exhibit_id: exhibit.id }
49
49
  expect(response).to redirect_to main_app.root_path
50
50
  end
51
51
  end
@@ -53,7 +53,7 @@ describe Spotlight::DashboardsController, type: :controller do
53
53
  describe 'when not logged in' do
54
54
  describe 'GET show' do
55
55
  it 'redirects to the sign in form' do
56
- get :show, exhibit_id: exhibit.id
56
+ get :show, params: { exhibit_id: exhibit.id }
57
57
  expect(response).to redirect_to(main_app.new_user_session_path)
58
58
  expect(flash[:alert]).to be_present
59
59
  expect(flash[:alert]).to match(/You need to sign in/)
@@ -15,7 +15,7 @@ describe Spotlight::ExhibitsController, type: :controller do
15
15
 
16
16
  describe 'GET edit' do
17
17
  it 'denies access' do
18
- get :edit, id: exhibit
18
+ get :edit, params: { id: exhibit }
19
19
  expect(response).to redirect_to main_app.root_path
20
20
  expect(flash[:alert]).to be_present
21
21
  end
@@ -32,35 +32,35 @@ describe Spotlight::ExhibitsController, type: :controller do
32
32
 
33
33
  describe 'GET new' do
34
34
  it 'is not allowed' do
35
- get :new, id: exhibit
35
+ get :new, params: { id: exhibit }
36
36
  expect(response).to redirect_to main_app.new_user_session_path
37
37
  end
38
38
  end
39
39
 
40
40
  describe 'GET edit' do
41
41
  it 'is not allowed' do
42
- get :edit, id: exhibit
42
+ get :edit, params: { id: exhibit }
43
43
  expect(response).to redirect_to main_app.new_user_session_path
44
44
  end
45
45
  end
46
46
 
47
47
  describe 'PATCH update' do
48
48
  it 'is not allowed' do
49
- patch :update, id: exhibit
49
+ patch :update, params: { id: exhibit }
50
50
  expect(response).to redirect_to main_app.new_user_session_path
51
51
  end
52
52
  end
53
53
 
54
54
  describe 'PATCH process_import' do
55
55
  it 'is not allowed' do
56
- patch :process_import, id: exhibit
56
+ patch :process_import, params: { id: exhibit }
57
57
  expect(response).to redirect_to main_app.new_user_session_path
58
58
  end
59
59
  end
60
60
 
61
61
  describe 'DELETE destroy' do
62
62
  it 'is not allowed' do
63
- delete :destroy, id: exhibit
63
+ delete :destroy, params: { id: exhibit }
64
64
  expect(response).to redirect_to main_app.new_user_session_path
65
65
  end
66
66
  end
@@ -85,7 +85,7 @@ describe Spotlight::ExhibitsController, type: :controller do
85
85
 
86
86
  it 'is successful' do
87
87
  expect do
88
- post :create, exhibit: { title: 'Some Title', slug: 'custom-slug', tag_list: '2014, R. Buckminster Fuller' }
88
+ post :create, params: { exhibit: { title: 'Some Title', slug: 'custom-slug', tag_list: '2014, R. Buckminster Fuller' } }
89
89
  end.to change { Spotlight::Exhibit.count }.by(1)
90
90
 
91
91
  exhibit = Spotlight::Exhibit.last
@@ -119,7 +119,7 @@ describe Spotlight::ExhibitsController, type: :controller do
119
119
  f.write '{ "title": "Foo", "subtitle": "Bar"}'
120
120
  f.rewind
121
121
  file = Rack::Test::UploadedFile.new(f.path, 'application/json')
122
- patch :process_import, id: exhibit, file: file
122
+ patch :process_import, params: { id: exhibit, file: file }
123
123
  ensure
124
124
  f.close
125
125
  f.unlink
@@ -137,18 +137,21 @@ describe Spotlight::ExhibitsController, type: :controller do
137
137
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
138
138
  expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
139
139
  expect(controller).to receive(:add_breadcrumb).with('General', edit_exhibit_path(exhibit))
140
- get :edit, id: exhibit
140
+ get :edit, params: { id: exhibit }
141
141
  expect(response).to be_successful
142
142
  end
143
143
  end
144
144
 
145
145
  describe '#update' do
146
146
  it 'is successful' do
147
- patch :update, id: exhibit, exhibit: {
148
- title: 'Foo',
149
- subtitle: 'Bar',
150
- description: 'Baz',
151
- contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@stanford.edu' } }
147
+ patch :update, params: {
148
+ id: exhibit,
149
+ exhibit: {
150
+ title: 'Foo',
151
+ subtitle: 'Bar',
152
+ description: 'Baz',
153
+ contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@stanford.edu' } }
154
+ }
152
155
  }
153
156
 
154
157
  expect(flash[:notice]).to eq 'The exhibit was successfully updated.'
@@ -162,11 +165,14 @@ describe Spotlight::ExhibitsController, type: :controller do
162
165
  end
163
166
 
164
167
  it 'shows errors and ignore blank emails' do
165
- patch :update, id: exhibit, exhibit: {
166
- title: 'Foo',
167
- subtitle: 'Bar',
168
- description: 'Baz',
169
- contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@' }, '2' => { email: '' } }
168
+ patch :update, params: {
169
+ id: exhibit,
170
+ exhibit: {
171
+ title: 'Foo',
172
+ subtitle: 'Bar',
173
+ description: 'Baz',
174
+ contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@' }, '2' => { email: '' } }
175
+ }
170
176
  }
171
177
 
172
178
  expect(response).to be_successful
@@ -179,7 +185,7 @@ describe Spotlight::ExhibitsController, type: :controller do
179
185
 
180
186
  describe '#destroy' do
181
187
  it 'is successful' do
182
- delete :destroy, id: exhibit
188
+ delete :destroy, params: { id: exhibit }
183
189
  expect(Spotlight::Exhibit.exists?(exhibit.id)).to be_falsey
184
190
  expect(flash[:notice]).to eq 'The exhibit was deleted.'
185
191
  expect(response).to redirect_to main_app.root_path
@@ -16,7 +16,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
16
16
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
17
17
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
18
18
  expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
19
- get :index, exhibit_id: exhibit
19
+ get :index, params: { exhibit_id: exhibit }
20
20
  expect(assigns(:pages)).to include page
21
21
  expect(assigns(:exhibit)).to eq exhibit
22
22
  end
@@ -28,7 +28,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
28
28
  it 'assigns the requested page as @page' do
29
29
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
30
30
  expect(controller).to receive(:add_breadcrumb).with(page.title, [exhibit, page])
31
- get :show, exhibit_id: page.exhibit.id, id: page
31
+ get :show, params: { exhibit_id: page.exhibit.id, id: page }
32
32
  expect(assigns(:page)).to eq(page)
33
33
  end
34
34
  end
@@ -38,7 +38,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
38
38
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
39
39
  expect(controller).to receive(:add_breadcrumb).with(page.parent_page.title, [exhibit, page.parent_page])
40
40
  expect(controller).to receive(:add_breadcrumb).with(page.title, [exhibit, page])
41
- get :show, exhibit_id: page.exhibit, id: page
41
+ get :show, params: { exhibit_id: page.exhibit, id: page }
42
42
  expect(assigns(:page)).to eq(page)
43
43
  end
44
44
  end
@@ -46,7 +46,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
46
46
 
47
47
  describe 'GET new' do
48
48
  it 'assigns a new page as @page' do
49
- get :new, exhibit_id: exhibit
49
+ get :new, params: { exhibit_id: exhibit }
50
50
  expect(assigns(:page)).to be_a_new(Spotlight::FeaturePage)
51
51
  expect(assigns(:page).exhibit).to eq exhibit
52
52
  end
@@ -59,7 +59,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
59
59
  expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
60
60
  expect(controller).to receive(:add_breadcrumb).with(page.parent_page.title, [exhibit, page.parent_page])
61
61
  expect(controller).to receive(:add_breadcrumb).with(page.title, [:edit, exhibit, page])
62
- get :edit, exhibit_id: page.exhibit.id, id: page.id
62
+ get :edit, params: { exhibit_id: page.exhibit.id, id: page.id }
63
63
  expect(assigns(:page)).to eq page
64
64
  end
65
65
  end
@@ -68,17 +68,17 @@ describe Spotlight::FeaturePagesController, type: :controller do
68
68
  describe 'with valid params' do
69
69
  it 'creates a new Page' do
70
70
  expect do
71
- post :create, feature_page: { title: 'MyString' }, exhibit_id: exhibit
71
+ post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
72
72
  end.to change(Spotlight::FeaturePage, :count).by(1)
73
73
  end
74
74
 
75
75
  it 'assigns a newly created page as @page' do
76
- post :create, feature_page: { title: 'MyString' }, exhibit_id: exhibit
76
+ post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
77
77
  expect(assigns(:page)).to be_a(Spotlight::FeaturePage)
78
78
  expect(assigns(:page)).to be_persisted
79
79
  end
80
80
  it 'redirects to the feature page index' do
81
- post :create, feature_page: { title: 'MyString' }, exhibit_id: exhibit
81
+ post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
82
82
  expect(response).to redirect_to(exhibit_feature_pages_path(Spotlight::FeaturePage.last.exhibit))
83
83
  end
84
84
  end
@@ -87,14 +87,14 @@ describe Spotlight::FeaturePagesController, type: :controller do
87
87
  it 'assigns a newly created but unsaved page as @page' do
88
88
  # Trigger the behavior that occurs when invalid params are submitted
89
89
  allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
90
- post :create, feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit
90
+ post :create, params: { feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit }
91
91
  expect(assigns(:page)).to be_a_new(Spotlight::FeaturePage)
92
92
  end
93
93
 
94
94
  it "re-renders the 'new' template" do
95
95
  # Trigger the behavior that occurs when invalid params are submitted
96
96
  allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
97
- post :create, feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit
97
+ post :create, params: { feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit }
98
98
  expect(response).to render_template('new')
99
99
  end
100
100
  end
@@ -109,16 +109,16 @@ describe Spotlight::FeaturePagesController, type: :controller do
109
109
  # receives the :update_attributes message with whatever params are
110
110
  # submitted in the request.
111
111
  expect_any_instance_of(Spotlight::FeaturePage).to receive(:update).with(hash_including(valid_attributes))
112
- put :update, id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes
112
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
113
113
  end
114
114
 
115
115
  it 'assigns the requested page as @page' do
116
- put :update, id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes
116
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
117
117
  expect(assigns(:page)).to eq(page)
118
118
  end
119
119
 
120
120
  it 'redirects to the feature page' do
121
- put :update, id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes
121
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
122
122
  page.reload
123
123
  expect(response).to redirect_to(exhibit_feature_page_path(page.exhibit, page))
124
124
  expect(flash[:notice]).to have_link 'Undo changes'
@@ -129,14 +129,14 @@ describe Spotlight::FeaturePagesController, type: :controller do
129
129
  it 'assigns the page as @page' do
130
130
  # Trigger the behavior that occurs when invalid params are submitted
131
131
  allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
132
- put :update, id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' }
132
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' } }
133
133
  expect(assigns(:page)).to eq(page)
134
134
  end
135
135
 
136
136
  it "re-renders the 'edit' template" do
137
137
  # Trigger the behavior that occurs when invalid params are submitted
138
138
  allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
139
- put :update, id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' }
139
+ put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' } }
140
140
  expect(response).to render_template('edit')
141
141
  end
142
142
  end
@@ -148,7 +148,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
148
148
  let!(:page3) { FactoryGirl.create(:feature_page, exhibit: page1.exhibit, parent_page_id: page1.id) }
149
149
  before { request.env['HTTP_REFERER'] = 'http://example.com' }
150
150
  it 'updates the parent/child relationship' do
151
- post :update_all, exhibit_id: page1.exhibit, exhibit: { feature_pages_attributes: [{ id: page2.id, parent_page_id: page1.id }] }
151
+ post :update_all, params: { exhibit_id: page1.exhibit, exhibit: { feature_pages_attributes: [{ id: page2.id, parent_page_id: page1.id }] } }
152
152
  expect(response).to redirect_to 'http://example.com'
153
153
  expect(flash[:notice]).to eq 'Feature pages were successfully updated.'
154
154
  expect(page1.parent_page).to be_nil
@@ -161,12 +161,12 @@ describe Spotlight::FeaturePagesController, type: :controller do
161
161
  let!(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
162
162
  it 'destroys the requested page' do
163
163
  expect do
164
- delete :destroy, id: page, exhibit_id: page.exhibit.id
164
+ delete :destroy, params: { id: page, exhibit_id: page.exhibit.id }
165
165
  end.to change(Spotlight::FeaturePage, :count).by(-1)
166
166
  end
167
167
 
168
168
  it 'redirects to the pages list' do
169
- delete :destroy, id: page, exhibit_id: page.exhibit.id
169
+ delete :destroy, params: { id: page, exhibit_id: page.exhibit.id }
170
170
  expect(response).to redirect_to(exhibit_feature_pages_path(page.exhibit))
171
171
  end
172
172
  end
@@ -11,7 +11,7 @@ describe Spotlight::FiltersController do
11
11
 
12
12
  context 'when not signed in' do
13
13
  it 'is not successful' do
14
- post :create, exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar_ssi' }
14
+ post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar_ssi' } }
15
15
  expect(:response).to redirect_to main_app.new_user_session_path
16
16
  end
17
17
  end
@@ -21,13 +21,13 @@ describe Spotlight::FiltersController do
21
21
  let(:user) { FactoryGirl.create(:site_admin) }
22
22
 
23
23
  it 'is successful' do
24
- post :create, exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar' }
24
+ post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar' } }
25
25
  expect(:response).to redirect_to edit_exhibit_path(exhibit, anchor: 'filter')
26
26
  expect(assigns[:exhibit].solr_data).to eq('foo_ssi' => 'bar')
27
27
  end
28
28
 
29
29
  it 'valids filter values' do
30
- post :create, exhibit_id: exhibit, filter: { field: 'foo_ssi', value: '' }
30
+ post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: '' } }
31
31
  expect(:response).to redirect_to edit_exhibit_path(exhibit, anchor: 'filter')
32
32
  expect(flash[:alert]).to include "Value can't be blank"
33
33
  end
@@ -44,7 +44,7 @@ describe Spotlight::FiltersController do
44
44
 
45
45
  context 'when not signed in' do
46
46
  it 'is not successful' do
47
- patch :update, exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar_ssi' }
47
+ patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar_ssi' } }
48
48
  expect(:response).to redirect_to main_app.new_user_session_path
49
49
  end
50
50
  end
@@ -54,13 +54,13 @@ describe Spotlight::FiltersController do
54
54
  let(:user) { FactoryGirl.create(:site_admin) }
55
55
 
56
56
  it 'is successful' do
57
- patch :update, exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar' }
57
+ patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar' } }
58
58
  expect(:response).to redirect_to edit_exhibit_path(exhibit, anchor: 'filter')
59
59
  expect(assigns[:exhibit].solr_data).to eq('foo_ssi' => 'bar')
60
60
  end
61
61
 
62
62
  it 'valids filter values' do
63
- patch :update, exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: '' }
63
+ patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: '' } }
64
64
  expect(:response).to redirect_to edit_exhibit_path(exhibit, anchor: 'filter')
65
65
  expect(flash[:alert]).to include "Value can't be blank"
66
66
  end