blacklight-spotlight 0.19.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/app/helpers/spotlight/title_helper.rb +1 -1
  4. data/lib/generators/spotlight/install_generator.rb +1 -1
  5. data/lib/spotlight/version.rb +1 -2
  6. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +0 -1
  7. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +0 -1
  8. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -1
  9. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -1
  10. data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -1
  11. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -1
  12. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -1
  13. data/spec/helpers/spotlight/application_helper_spec.rb +4 -11
  14. data/spec/helpers/spotlight/browse_helper_spec.rb +0 -1
  15. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +124 -127
  16. data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -1
  17. data/spec/helpers/spotlight/navbar_helper_spec.rb +16 -19
  18. data/spec/helpers/spotlight/pages_helper_spec.rb +74 -76
  19. data/spec/helpers/spotlight/roles_helper_spec.rb +0 -1
  20. data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -2
  21. data/spec/helpers/spotlight/title_helper_spec.rb +0 -1
  22. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -1
  23. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -1
  24. data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -1
  25. data/spec/models/spotlight/analytics/ga_spec.rb +0 -1
  26. data/spec/models/spotlight/resources/open_graph_spec.rb +0 -1
  27. data/spec/models/spotlight/resources/upload_spec.rb +0 -1
  28. data/spec/models/spotlight/resources/web_spec.rb +0 -1
  29. data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -1
  30. data/spec/models/spotlight/solr_document/spotlight_images_spec.rb +0 -1
  31. data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -1
  32. data/spec/routing/spotlight/exhibit_catalog_spec.rb +5 -8
  33. data/spec/test_app_templates/catalog_controller.rb +1 -1
  34. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -1
  35. data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -1
  36. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -1
  37. data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -1
  38. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -1
  39. data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +0 -1
  40. data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -1
  41. data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -1
  42. data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -1
  43. data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +31 -35
  44. data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -1
  45. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -1
  46. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -1
  47. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -1
  48. data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +0 -1
  49. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +19 -21
  50. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +95 -99
  51. data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -1
  52. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -1
  53. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -1
  54. data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -1
  55. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +19 -23
  56. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +16 -20
  57. data/spec/views/spotlight/pages/edit.html.erb_spec.rb +43 -47
  58. data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -1
  59. data/spec/views/spotlight/pages/new.html.erb_spec.rb +12 -16
  60. data/spec/views/spotlight/pages/show.html.erb_spec.rb +66 -61
  61. data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -1
  62. data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -1
  63. data/spec/views/spotlight/roles/index.html.erb_spec.rb +20 -25
  64. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +20 -24
  65. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +31 -45
  66. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +19 -24
  67. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -1
  68. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -1
  69. data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -1
  70. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -1
  71. data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -1
  72. data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -1
  73. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -1
  74. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -1
  75. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -1
  76. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -1
  77. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -1
  78. data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +18 -24
  79. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
  80. metadata +180 -181
  81. data/lib/generators/spotlight/templates/jetty.rake +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 797e808c409dd777422ae85313b3730de6bd0cd3
4
- data.tar.gz: 95908a121831207677ffe422e1b67cb5a451bca1
3
+ metadata.gz: 9fcd8fc066ada25ea481ac2794e080804013a3dd
4
+ data.tar.gz: b915e2ddab7b609f7359cca735298a04433fd5a3
5
5
  SHA512:
6
- metadata.gz: 2789c3565185605cb60facf97aa1958825d121d4e412d989bb77ba9df20460211236a269812703457624b3d55d152acab312da275a78e601c061cb70aada9d58
7
- data.tar.gz: ee69b30eb9115c7e96f1cd853cce54949d1f42fe8d9b94cce4eea451308532bbaa2c440570d51fea763e4edb777789bd430bd794058510782f1eaef5a48a9b32
6
+ metadata.gz: 9a905461d224104c93c8d6d215088e50e5c450e2abe82ca0db2d13e7c16f2e6abf0fad2eb41bb6cb4af872a1a130ab40fdf63e044645eeb46a1c2c7c0f58047e
7
+ data.tar.gz: bad97d38c3b0ddf5917e688068d64d6a6d22bfa5fbd6d4b2e96f8993250e008dea0900d6cec5a92ad843c35f509a4a41b3339356370125229475b18ffc1bf3fb
data/README.md CHANGED
@@ -73,7 +73,6 @@ Our `$ rake ci` and `$ rake spotlight:server` tasks utilize Solr and the testing
73
73
  ## More Information for Developers
74
74
 
75
75
  * [Contributing to Spotlight](https://github.com/projectblacklight/spotlight/wiki/Contributing-to-Spotlight)
76
- * [Testing](https://github.com/projectblacklight/spotlight/wiki/Testing)
77
76
 
78
77
  ## Tests
79
78
 
@@ -17,7 +17,7 @@ module Spotlight
17
17
 
18
18
  # rubocop:disable Style/AccessorMethodName
19
19
  def set_html_page_title(title = nil)
20
- @page_title = strip_tags(t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name: application_name))
20
+ @page_title = strip_tags(t(:'spotlight.html_title', title: title || t(:'.title', default: :'.header'), application_name: application_name)).html_safe
21
21
  end
22
22
  # rubocop:enable Style/AccessorMethodName
23
23
  end
@@ -124,7 +124,7 @@ module Spotlight
124
124
  end
125
125
 
126
126
  def add_solr_config_resources
127
- copy_file 'jetty.rake', 'lib/tasks/jetty.rake'
127
+ copy_file '.solr_wrapper.yml', '.solr_wrapper.yml'
128
128
  directory 'solr_conf'
129
129
  end
130
130
 
@@ -1,4 +1,3 @@
1
- #
2
1
  module Spotlight
3
- VERSION = '0.19.0'.freeze
2
+ VERSION = '0.19.1'.freeze
4
3
  end
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe Spotlight::Resources::CsvUploadController, type: :controller do
4
3
  routes { Spotlight::Engine.routes }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe Spotlight::Resources::UploadController, type: :controller do
4
3
  routes { Spotlight::Engine.routes }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe 'Featured Browse Category Block', type: :feature, js: true do
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe 'Featured Pages Blocks', type: :feature, js: true do
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe 'Search Result Block', type: :feature, js: true do
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  feature 'Solr Document Block', feature: true do
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  feature 'Uploaded Items Block', feature: true, js: true do
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::ApplicationHelper, type: :helper do
3
2
  describe '#application_name' do
4
3
  let(:site) { Spotlight::Site.instance }
@@ -77,6 +76,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
77
76
  end
78
77
  end
79
78
  end
79
+
80
80
  describe 'render_document_class' do
81
81
  let(:current_exhibit) { FactoryGirl.create(:exhibit) }
82
82
  let(:document) { SolrDocument.new(some_field: 'Some data') }
@@ -133,13 +133,8 @@ describe Spotlight::ApplicationHelper, type: :helper do
133
133
  end
134
134
 
135
135
  describe '#uploaded_field_label' do
136
- let :field do
137
- OpenStruct.new field_name: 'x'
138
- end
139
-
140
- let :blacklight_config do
141
- Blacklight::Configuration.new
142
- end
136
+ let(:field) { OpenStruct.new field_name: 'x' }
137
+ let(:blacklight_config) { Blacklight::Configuration.new }
143
138
 
144
139
  before do
145
140
  allow(helper).to receive_messages(blacklight_config: blacklight_config)
@@ -157,9 +152,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
157
152
  end
158
153
 
159
154
  describe '#available_view_fields' do
160
- let :blacklight_config do
161
- Blacklight::Configuration.new
162
- end
155
+ let(:blacklight_config) { Blacklight::Configuration.new }
163
156
 
164
157
  before do
165
158
  allow(helper).to receive_message_chain(:current_exhibit, :blacklight_configuration, default_blacklight_config: blacklight_config)
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::BrowseHelper, type: :helper do
3
2
  it 'defaults to the gallery' do
4
3
  allow(helper).to receive_messages(blacklight_config: double(view: { gallery: true }))
@@ -1,132 +1,129 @@
1
+ describe Spotlight::CrudLinkHelpers, type: :helper do
2
+ let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
4
+ describe '#cancel_link' do
5
+ it 'is a model-specific cancel link' do
6
+ expect(helper).to receive(:action_default_value).with(:my_model, :cancel).and_return 'Cancel'
7
+ expect(helper.cancel_link(:my_model, '#')).to have_link 'Cancel', href: '#'
8
+ end
9
+ end
10
+
11
+ describe '#exhibit_view_link' do
12
+ before do
13
+ allow(helper).to receive_messages action_default_value: 'View'
14
+ end
15
+
16
+ it 'is a model-specific view link' do
17
+ expect(helper).to receive(:action_default_value).with(some_model, :view).and_return 'View'
18
+ expect(helper.exhibit_view_link(some_model)).to have_link 'View', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
19
+ end
20
+
21
+ it 'accepts an explicit link' do
22
+ expect(helper.exhibit_view_link(some_model, '#')).to have_link 'View', href: '#'
23
+ end
24
+
25
+ it 'accepts link_to options' do
26
+ expect(helper.exhibit_view_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
27
+ end
28
+ end
29
+
30
+ describe '#exhibit_create_link' do
31
+ let(:some_model) { Spotlight::FeaturePage.new }
32
+ before do
33
+ allow(helper).to receive_messages(current_exhibit: exhibit)
34
+ allow(helper).to receive_messages action_default_value: 'Create'
35
+ end
36
+
37
+ it 'is a model-specific view link' do
38
+ expect(helper).to receive(:action_default_value).with(some_model).and_return 'Create'
39
+ expect(helper.exhibit_create_link(some_model)).to have_link 'Create', href: spotlight.new_exhibit_feature_page_path(exhibit)
40
+ end
41
+
42
+ it 'accepts an explicit link' do
43
+ expect(helper.exhibit_create_link(some_model, '#')).to have_link 'Create', href: '#'
44
+ end
45
+
46
+ it 'accepts link_to options' do
47
+ expect(helper.exhibit_create_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
48
+ end
49
+ end
1
50
 
2
- module Spotlight
3
- describe CrudLinkHelpers, type: :helper do
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
51
+ describe '#exhibit_edit_link' do
5
52
  let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
6
- describe '#cancel_link' do
7
- it 'is a model-specific cancel link' do
8
- expect(helper).to receive(:action_default_value).with(:my_model, :cancel).and_return 'Cancel'
9
- expect(helper.cancel_link(:my_model, '#')).to have_link 'Cancel', href: '#'
10
- end
11
- end
12
-
13
- describe '#exhibit_view_link' do
14
- before do
15
- allow(helper).to receive_messages action_default_value: 'View'
16
- end
17
-
18
- it 'is a model-specific view link' do
19
- expect(helper).to receive(:action_default_value).with(some_model, :view).and_return 'View'
20
- expect(helper.exhibit_view_link(some_model)).to have_link 'View', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
21
- end
22
-
23
- it 'accepts an explicit link' do
24
- expect(helper.exhibit_view_link(some_model, '#')).to have_link 'View', href: '#'
25
- end
26
-
27
- it 'accepts link_to options' do
28
- expect(helper.exhibit_view_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
29
- end
30
- end
31
-
32
- describe '#exhibit_create_link' do
33
- let(:some_model) { Spotlight::FeaturePage.new }
34
- before do
35
- allow(helper).to receive_messages(current_exhibit: exhibit)
36
- allow(helper).to receive_messages action_default_value: 'Create'
37
- end
38
-
39
- it 'is a model-specific view link' do
40
- expect(helper).to receive(:action_default_value).with(some_model).and_return 'Create'
41
- expect(helper.exhibit_create_link(some_model)).to have_link 'Create', href: spotlight.new_exhibit_feature_page_path(exhibit)
42
- end
43
-
44
- it 'accepts an explicit link' do
45
- expect(helper.exhibit_create_link(some_model, '#')).to have_link 'Create', href: '#'
46
- end
47
-
48
- it 'accepts link_to options' do
49
- expect(helper.exhibit_create_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
50
- end
51
- end
52
-
53
- describe '#exhibit_edit_link' do
54
- let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
55
- before do
56
- allow(helper).to receive_messages(current_exhibit: exhibit)
57
- allow(helper).to receive_messages action_default_value: 'Edit'
58
- end
59
-
60
- it 'is a model-specific edit link' do
61
- expect(helper).to receive(:action_default_value).with(some_model).and_return 'Edit'
62
- expect(helper.exhibit_edit_link(some_model)).to have_link 'Edit', href: spotlight.edit_exhibit_feature_page_path(exhibit, some_model)
63
- end
64
-
65
- it 'accepts an explicit link' do
66
- expect(helper.exhibit_edit_link(some_model, '#')).to have_link 'Edit', href: '#'
67
- end
68
-
69
- it 'accepts link_to options' do
70
- expect(helper.exhibit_edit_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
71
- end
72
- end
73
-
74
- describe '#exhibit_delete_link' do
75
- before do
76
- allow(helper).to receive_messages action_default_value: 'Delete'
77
- end
78
-
79
- it 'is a model-specific view link' do
80
- expect(helper).to receive(:action_default_value).with(some_model, :destroy).and_return 'Delete'
81
- expect(helper.exhibit_delete_link(some_model)).to have_link 'Delete', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
82
- end
83
-
84
- it 'accepts an explicit link' do
85
- expect(helper.exhibit_delete_link(some_model, '#')).to have_link 'Delete', href: '#'
86
- end
87
-
88
- it 'accepts link_to options' do
89
- expect(helper.exhibit_delete_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
90
- end
91
- end
92
-
93
- describe '#action_label' do
94
- it 'returns the label for an action on a model' do
95
- some_model = double
96
- expect(helper).to receive(:action_default_value).with(some_model, :action).and_return 'xyz'
97
- expect(helper.action_label(some_model, :action)).to eq 'xyz'
98
- end
99
- end
100
-
101
- describe '#action_default_value' do
102
- it 'attempts i18n lookups for models' do
103
- expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.edit',
104
- model: some_model.class.model_name.human,
105
- default: [:'helpers.action.edit', 'Edit Feature page'])
106
- expect(helper.send(:action_default_value, some_model))
107
- end
108
-
109
- it 'attempts i18n lookups for unpersisted models' do
110
- some_model = Spotlight::FeaturePage.new
111
- expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.create',
112
- model: some_model.class.model_name.human,
113
- default: [:'helpers.action.create', 'Create Feature page'])
114
- expect(helper.send(:action_default_value, some_model))
115
- end
116
-
117
- it 'attempts i18n lookups for models with an explicit action' do
118
- expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.custom_action',
119
- model: some_model.class.model_name.human,
120
- default: [:'helpers.action.custom_action', 'Custom action Feature page'])
121
- expect(helper.send(:action_default_value, some_model, :custom_action))
122
- end
123
-
124
- it 'attempts i18n lookups for symbols' do
125
- expect(I18n).to receive(:t).with(:'helpers.action.my_thing.custom_action',
126
- model: :my_thing,
127
- default: [:'helpers.action.custom_action', 'Custom action my_thing'])
128
- expect(helper.send(:action_default_value, :my_thing, :custom_action))
129
- end
53
+ before do
54
+ allow(helper).to receive_messages(current_exhibit: exhibit)
55
+ allow(helper).to receive_messages action_default_value: 'Edit'
56
+ end
57
+
58
+ it 'is a model-specific edit link' do
59
+ expect(helper).to receive(:action_default_value).with(some_model).and_return 'Edit'
60
+ expect(helper.exhibit_edit_link(some_model)).to have_link 'Edit', href: spotlight.edit_exhibit_feature_page_path(exhibit, some_model)
61
+ end
62
+
63
+ it 'accepts an explicit link' do
64
+ expect(helper.exhibit_edit_link(some_model, '#')).to have_link 'Edit', href: '#'
65
+ end
66
+
67
+ it 'accepts link_to options' do
68
+ expect(helper.exhibit_edit_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
69
+ end
70
+ end
71
+
72
+ describe '#exhibit_delete_link' do
73
+ before do
74
+ allow(helper).to receive_messages action_default_value: 'Delete'
75
+ end
76
+
77
+ it 'is a model-specific view link' do
78
+ expect(helper).to receive(:action_default_value).with(some_model, :destroy).and_return 'Delete'
79
+ expect(helper.exhibit_delete_link(some_model)).to have_link 'Delete', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
80
+ end
81
+
82
+ it 'accepts an explicit link' do
83
+ expect(helper.exhibit_delete_link(some_model, '#')).to have_link 'Delete', href: '#'
84
+ end
85
+
86
+ it 'accepts link_to options' do
87
+ expect(helper.exhibit_delete_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
88
+ end
89
+ end
90
+
91
+ describe '#action_label' do
92
+ it 'returns the label for an action on a model' do
93
+ some_model = double
94
+ expect(helper).to receive(:action_default_value).with(some_model, :action).and_return 'xyz'
95
+ expect(helper.action_label(some_model, :action)).to eq 'xyz'
96
+ end
97
+ end
98
+
99
+ describe '#action_default_value' do
100
+ it 'attempts i18n lookups for models' do
101
+ expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.edit',
102
+ model: some_model.class.model_name.human,
103
+ default: [:'helpers.action.edit', 'Edit Feature page'])
104
+ expect(helper.send(:action_default_value, some_model))
105
+ end
106
+
107
+ it 'attempts i18n lookups for unpersisted models' do
108
+ some_model = Spotlight::FeaturePage.new
109
+ expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.create',
110
+ model: some_model.class.model_name.human,
111
+ default: [:'helpers.action.create', 'Create Feature page'])
112
+ expect(helper.send(:action_default_value, some_model))
113
+ end
114
+
115
+ it 'attempts i18n lookups for models with an explicit action' do
116
+ expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.custom_action',
117
+ model: some_model.class.model_name.human,
118
+ default: [:'helpers.action.custom_action', 'Custom action Feature page'])
119
+ expect(helper.send(:action_default_value, some_model, :custom_action))
120
+ end
121
+
122
+ it 'attempts i18n lookups for symbols' do
123
+ expect(I18n).to receive(:t).with(:'helpers.action.my_thing.custom_action',
124
+ model: :my_thing,
125
+ default: [:'helpers.action.custom_action', 'Custom action my_thing'])
126
+ expect(helper.send(:action_default_value, :my_thing, :custom_action))
130
127
  end
131
128
  end
132
129
  end
@@ -1,4 +1,3 @@
1
-
2
1
  describe Spotlight::JcropHelper do
3
2
  describe '.default_thumbnail_jcrop_options' do
4
3
  it 'produces a 4:3 aspect ratio by default' do
@@ -1,22 +1,19 @@
1
-
2
- module Spotlight
3
- describe NavbarHelper, type: :helper do
4
- describe '#should_render_search_bar?' do
5
- before do
6
- allow(helper).to receive_messages(current_exhibit: nil)
7
- allow(helper).to receive_messages(exhibit_masthead?: true)
8
- end
9
- it 'returns false when there is no exhibit context' do
10
- expect(helper.should_render_spotlight_search_bar?).to be_falsey
11
- end
12
- it 'returns true if searchable' do
13
- allow(helper).to receive_messages(current_exhibit: double(searchable?: true))
14
- expect(helper.should_render_spotlight_search_bar?).to be_truthy
15
- end
16
- it 'returns false if currently under an "Exhibity" browse category' do
17
- allow(helper).to receive_messages(exhibit_masthead?: false)
18
- expect(helper.should_render_spotlight_search_bar?).to be_falsey
19
- end
1
+ describe Spotlight::NavbarHelper, type: :helper do
2
+ describe '#should_render_search_bar?' do
3
+ before do
4
+ allow(helper).to receive_messages(current_exhibit: nil)
5
+ allow(helper).to receive_messages(exhibit_masthead?: true)
6
+ end
7
+ it 'returns false when there is no exhibit context' do
8
+ expect(helper.should_render_spotlight_search_bar?).to be_falsey
9
+ end
10
+ it 'returns true if searchable' do
11
+ allow(helper).to receive_messages(current_exhibit: double(searchable?: true))
12
+ expect(helper.should_render_spotlight_search_bar?).to be_truthy
13
+ end
14
+ it 'returns false if currently under an "Exhibity" browse category' do
15
+ allow(helper).to receive_messages(exhibit_masthead?: false)
16
+ expect(helper.should_render_spotlight_search_bar?).to be_falsey
20
17
  end
21
18
  end
22
19
  end
@@ -1,95 +1,93 @@
1
+ describe Spotlight::PagesHelper, type: :helper do
2
+ let(:blacklight_config) { Blacklight::Configuration.new { |config| config.show.title_field = :abc } }
3
+ let(:titled_document) { blacklight_config.document_model.new(abc: 'value') }
4
+ let(:untitled_document) { blacklight_config.document_model.new(id: '1234') }
5
+ let!(:current_exhibit) { FactoryGirl.create(:exhibit) }
6
+ let!(:home_page) { current_exhibit.home_page }
7
+ let!(:search) { FactoryGirl.create(:search, exhibit: current_exhibit, query_params: { 'q' => 'query' }, published: true) }
1
8
 
2
- module Spotlight
3
- describe PagesHelper, type: :helper do
4
- let(:blacklight_config) { Blacklight::Configuration.new { |config| config.show.title_field = :abc } }
5
- let(:titled_document) { blacklight_config.document_model.new(abc: 'value') }
6
- let(:untitled_document) { blacklight_config.document_model.new(id: '1234') }
7
- let!(:current_exhibit) { FactoryGirl.create(:exhibit) }
8
- let!(:home_page) { current_exhibit.home_page }
9
- let!(:search) { FactoryGirl.create(:search, exhibit: current_exhibit, query_params: { 'q' => 'query' }, published: true) }
9
+ before(:each) do
10
+ allow(helper).to receive_messages(blacklight_config: blacklight_config)
11
+ end
10
12
 
11
- before(:each) do
12
- allow(helper).to receive_messages(blacklight_config: blacklight_config)
13
+ describe 'available_index_fields' do
14
+ before do
15
+ blacklight_config.index.title_field = :title_field
16
+ blacklight_config.add_index_field 'x', label: 'X'
13
17
  end
14
18
 
15
- describe 'available_index_fields' do
16
- before do
17
- blacklight_config.index.title_field = :title_field
18
- blacklight_config.add_index_field 'x', label: 'X'
19
- end
19
+ it 'lists the configured index fields' do
20
+ expect(helper.available_index_fields).to include key: 'x', label: 'X'
21
+ end
20
22
 
21
- it 'lists the configured index fields' do
22
- expect(helper.available_index_fields).to include key: 'x', label: 'X'
23
- end
23
+ it 'adds the title field if necessary' do
24
+ expect(helper.available_index_fields).to include key: :title_field, label: 'Title'
25
+ end
26
+ end
24
27
 
25
- it 'adds the title field if necessary' do
26
- expect(helper.available_index_fields).to include key: :title_field, label: 'Title'
27
- end
28
+ describe 'disable_save_pages_button?' do
29
+ it 'returns true if there are no pages and we are on the about pages page' do
30
+ expect(helper).to receive(:page_collection_name).and_return('about_pages')
31
+ assign(:pages, [])
32
+ expect(helper.disable_save_pages_button?).to be_truthy
33
+ end
34
+ it 'returns false if there are about pages' do
35
+ expect(helper).to receive(:page_collection_name).and_return('about_pages')
36
+ assign(:pages, [{}])
37
+ expect(helper.disable_save_pages_button?).to be_falsey
38
+ end
39
+ it 'returns false if on the feature pages page' do
40
+ expect(helper).to receive(:page_collection_name).and_return('feature_pages')
41
+ assign(:pages, [])
42
+ expect(helper.disable_save_pages_button?).to be_falsey
28
43
  end
44
+ end
29
45
 
30
- describe 'disable_save_pages_button?' do
31
- it 'returns true if there are no pages and we are on the about pages page' do
32
- expect(helper).to receive(:page_collection_name).and_return('about_pages')
33
- assign(:pages, [])
34
- expect(helper.disable_save_pages_button?).to be_truthy
35
- end
36
- it 'returns false if there are about pages' do
37
- expect(helper).to receive(:page_collection_name).and_return('about_pages')
38
- assign(:pages, [{}])
39
- expect(helper.disable_save_pages_button?).to be_falsey
40
- end
41
- it 'returns false if on the feature pages page' do
42
- expect(helper).to receive(:page_collection_name).and_return('feature_pages')
43
- assign(:pages, [])
44
- expect(helper.disable_save_pages_button?).to be_falsey
45
- end
46
+ describe 'get_search_widget_search_results' do
47
+ let(:good) do
48
+ content = { type: 'xyz', data: { 'item' => { search.slug => { id: search.slug, display: 'true' } } } }
49
+ SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
46
50
  end
47
- describe 'get_search_widget_search_results' do
48
- let(:good) do
49
- content = { type: 'xyz', data: { 'item' => { search.slug => { id: search.slug, display: 'true' } } } }
50
- SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
51
- end
52
51
 
53
- let(:bad) do
54
- content = { type: 'xyz', data: { 'item' => { 'garbage' => { id: 'missing', display: 'true' } } } }
55
- SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
56
- end
52
+ let(:bad) do
53
+ content = { type: 'xyz', data: { 'item' => { 'garbage' => { id: 'missing', display: 'true' } } } }
54
+ SirTrevorRails::Blocks::SearchResultsBlock.new(content, home_page)
55
+ end
57
56
 
58
- let(:search_result) { [double('response'), double('documents')] }
57
+ let(:search_result) { [double('response'), double('documents')] }
59
58
 
60
- it 'returns the results for a given search browse category' do
61
- expect(helper).to receive(:search_results).with('q' => 'query').and_return(search_result)
62
- expect(helper.get_search_widget_search_results(good)).to eq search_result
59
+ it 'returns the results for a given search browse category' do
60
+ expect(helper).to receive(:search_results).with('q' => 'query').and_return(search_result)
61
+ expect(helper.get_search_widget_search_results(good)).to eq search_result
62
+ end
63
+ it "returns an empty array when requesting a search that doesn't exist" do
64
+ expect(helper.get_search_widget_search_results(bad)).to be_empty
65
+ end
66
+ end
67
+
68
+ describe 'nestable helpers' do
69
+ describe 'nestable data attributes' do
70
+ it 'returns the appropriate attributes for feature pages' do
71
+ expect(helper.nestable_data_attributes('feature_pages')).to eq "data-max-depth='2' data-expand-btn-HTML='' data-collapse-btn-HTML=''"
72
+ end
73
+ it 'returns the appropriate attributes for about pages' do
74
+ expect(helper.nestable_data_attributes('about_pages')).to eq "data-max-depth='1'"
63
75
  end
64
- it "returns an empty array when requesting a search that doesn't exist" do
65
- expect(helper.get_search_widget_search_results(bad)).to be_empty
76
+ it 'returns a blank string if the type is not valid' do
77
+ expect(helper.nestable_data_attributes('something_else')).to eq ''
66
78
  end
67
79
  end
68
-
69
- describe 'nestable helpers' do
70
- describe 'nestable data attributes' do
71
- it 'returns the appropriate attributes for feature pages' do
72
- expect(helper.nestable_data_attributes('feature_pages')).to eq "data-max-depth='2' data-expand-btn-HTML='' data-collapse-btn-HTML=''"
73
- end
74
- it 'returns the appropriate attributes for about pages' do
75
- expect(helper.nestable_data_attributes('about_pages')).to eq "data-max-depth='1'"
76
- end
77
- it 'returns a blank string if the type is not valid' do
78
- expect(helper.nestable_data_attributes('something_else')).to eq ''
79
- end
80
+ describe 'nestable data attributes hash' do
81
+ it 'returns the appropriate hash for feature pages' do
82
+ expect(helper.nestable_data_attributes_hash('feature_pages')).to eq('data-max-depth' => '2',
83
+ 'data-expand-btn-HTML' => '',
84
+ 'data-collapse-btn-HTML' => '')
85
+ end
86
+ it 'returns the appropriate hash for about pages' do
87
+ expect(helper.nestable_data_attributes_hash('about_pages')).to eq 'data-max-depth' => '1'
80
88
  end
81
- describe 'nestable data attributes hash' do
82
- it 'returns the appropriate hash for feature pages' do
83
- expect(helper.nestable_data_attributes_hash('feature_pages')).to eq('data-max-depth' => '2',
84
- 'data-expand-btn-HTML' => '',
85
- 'data-collapse-btn-HTML' => '')
86
- end
87
- it 'returns the appropriate hash for about pages' do
88
- expect(helper.nestable_data_attributes_hash('about_pages')).to eq 'data-max-depth' => '1'
89
- end
90
- it 'returns an empty hash if the type is not valid' do
91
- expect(helper.nestable_data_attributes_hash('something_else')).to eq({})
92
- end
89
+ it 'returns an empty hash if the type is not valid' do
90
+ expect(helper.nestable_data_attributes_hash('something_else')).to eq({})
93
91
  end
94
92
  end
95
93
  end