-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathstatic_controller_test.rb
More file actions
742 lines (663 loc) · 25.6 KB
/
Copy pathstatic_controller_test.rb
File metadata and controls
742 lines (663 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
require 'test_helper'
class StaticControllerTest < ActionController::TestCase
include Devise::Test::ControllerHelpers
test 'should get home' do
get :home
assert_response :success
end
test 'should show tabs for enabled features' do
features = { 'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features) do
get :home
end
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', materials_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', collections_path
assert_select 'li.dropdown.directory-menu' do
assert_select 'li a[href=?]', content_providers_path
assert_select 'li a[href=?]', trainers_path
assert_select 'li a[href=?]', nodes_path
end
end
end
test 'should not show tabs for disabled features' do
features = { 'events': false,
'materials': false,
'elearning_materials': false,
'workflows': false,
'collections': false,
'content_providers': false,
'trainers': false,
'nodes': false,
'spaces': false
}
with_settings(feature: features) do
get :home
end
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', events_path, count: 0
assert_select 'li a[href=?]', materials_path, count: 0
assert_select 'li a[href=?]', workflows_path, count: 0
assert_select 'li a[href=?]', elearning_materials_path, count: 0
assert_select 'li a[href=?]', collections_path, count: 0
assert_select 'li a[href=?]', content_providers_path, count: 0
assert_select 'li a[href=?]', trainers_path, count: 0
assert_select 'li a[href=?]', nodes_path, count: 0
assert_select 'li.dropdown.directory-menu', count: 0
end
end
test 'should allow configuration of home page sections' do
site_settings = TeSS::Config.site.dup
site_settings['home_page'] = {
'catalogue_blocks': false,
'provider_carousel': false,
'featured_providers': nil,
'faq': [],
'promo_blocks': false,
'search_box': false
}
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 0
assert_select 'section#providers', count: 0
assert_select 'section#faq', count: 0
assert_select 'ul#promo-blocks', count: 0
assert_select 'ul#promo-blocks', count: 0
assert_select 'div.searchbox', count: 0
end
site_settings['home_page']['catalogue_blocks'] = true
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 1
assert_select 'section#providers', count: 0
assert_select 'section#faq', count: 0
assert_select 'ul#promo-blocks', count: 0
assert_select 'div.searchbox', count: 0
end
site_settings['home_page']['provider_carousel'] = true
provider = content_providers(:goblet)
provider2 = content_providers(:iann)
site_settings['home_page']['featured_providers'] = [provider, provider2]
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 1
assert_select 'section#providers', count: 1
assert_select 'section#providers .item a[href=?]', content_provider_path(provider)
assert_select 'section#providers .item a[href=?]', content_provider_path(provider2)
assert_select 'section#faq', count: 0
assert_select 'ul#promo-blocks', count: 0
assert_select 'div.searchbox', count: 0
end
site_settings['home_page']['faq'] = %w[who why]
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 1
assert_select 'section#providers', count: 1
assert_select 'section#faq', count: 1
assert_select 'section#faq .question', count: 2
assert_select 'ul#promo-blocks', count: 0
assert_select 'div.searchbox', count: 0
end
site_settings['home_page']['promo_blocks'] = true
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 1
assert_select 'section#providers', count: 1
assert_select 'section#faq', count: 1
assert_select 'ul#promo-blocks', count: 1
assert_select 'div.searchbox', count: 0
end
site_settings['home_page']['search_box'] = true
with_settings({ site: site_settings }) do
get :home
assert_select 'section#catalogue', count: 1
assert_select 'section#providers', count: 1
assert_select 'section#faq', count: 1
assert_select 'ul#promo-blocks', count: 1
assert_select 'div.searchbox', count: 1
end
end
test 'should allow configuration of tab order and directory' do
features = { 'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features, site: { tab_order: %w[materials events], directory_tabs: [] }) do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li:nth-child(1) a[href=?]', materials_path
assert_select 'li:nth-child(2) a[href=?]', events_path
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', collections_path
assert_select 'li a[href=?]', content_providers_path
assert_select 'li a[href=?]', trainers_path
assert_select 'li a[href=?]', nodes_path
assert_select 'li.dropdown.directory-menu', count: 0
end
end
with_settings(feature: features, site: { tab_order: %w[content_providers about materials trainers],
directory_tabs: [] }) do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li:nth-child(1) a[href=?]', content_providers_path
assert_select 'li:nth-child(2) a[href=?]', about_path
assert_select 'li:nth-child(3) a[href=?]', materials_path
assert_select 'li:nth-child(4) a[href=?]', trainers_path
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', collections_path
assert_select 'li a[href=?]', nodes_path
assert_select 'li.dropdown.directory-menu', count: 0
end
end
with_settings(feature: features, site: { tab_order: %w[content_providers about materials trainers],
directory_tabs: %w[about materials] }) do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li:nth-child(1) a[href=?]', content_providers_path
assert_select 'li:nth-child(2) a[href=?]', trainers_path
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', collections_path
assert_select 'li a[href=?]', nodes_path
assert_select 'li.dropdown.directory-menu' do
assert_select 'li:nth-child(1) a[href=?]', about_path
assert_select 'li:nth-child(2) a[href=?]', materials_path
end
end
end
end
test 'should allow configuration of custom links on home page' do
site_settings = TeSS::Config.site.dup
site_settings['home_page'] = {
'catalogue_blocks': false,
'provider_carousel': false,
'featured_providers': nil,
'faq': [],
'promo_blocks': false,
'search_box': false,
'additional_links': nil
}
with_settings({ site: site_settings }) do
get :home
assert_select 'section#additional_links', count: 0
assert_select 'a[href="https://example.org/"]', count: 0
assert_select '#example-link-2', count: 0
end
site_settings['home_page']['additional_links'] = [
{
'url': 'https://example.org/',
'icon': 'placeholder-person.png',
'title': 'My Example Link'
},
{
'url': 'https://example.org/2',
'icon': 'https://example.org/image.png',
'title': 'My Other Example Link',
'id': 'example-link-2',
'new_tab': true
}
]
with_settings({ site: site_settings }) do
get :home
assert_select 'section#additional_links', count: 1
assert_select 'a[href=?]', 'https://example.org/' do
assert_select 'img[src]'
assert_select 'h3', 'My Example Link'
end
assert_select 'li#example-link-2' do
assert_select 'a[href=?][target="_blank"]', 'https://example.org/2' do
assert_select 'img[src=?]', 'https://example.org/image.png'
assert_select 'h3', 'My Other Example Link'
end
end
end
end
test 'should hide unverified providers from carousel' do
mock_images
ContentProvider.destroy_all
regular = users(:regular_user)
unverified = users(:unverified_user)
regular_provider = regular.content_providers.create!(title: 'Regular Provider',
image_url: 'http://example.com/goblet.png',
url: 'https://providers.com/p1')
unverified_provider = unverified.content_providers.create!(title: 'Unverified Provider',
image_url: 'http://example.com/goblet.png',
url: 'https://providers.com/p2')
another_provider = regular.content_providers.create!(title: 'Another Regular Provider',
image_url: 'http://example.com/goblet.png',
url: 'https://providers.com/p3')
with_settings(site: { home_page: { provider_carousel: true } }) do
get :home
assert_select 'section#providers .item', count: 2
assert_select 'section#providers .item a[href=?]', content_provider_path(regular_provider)
assert_select 'section#providers .item a[href=?]', content_provider_path(unverified_provider), count: 0
assert_select 'section#providers .item a[href=?]', content_provider_path(another_provider)
end
end
test 'should show upcoming events' do
my_events = [events(:one), events(:two)]
my_events.each do |e|
e.start = Time.zone.tomorrow
e.end = Time.zone.tomorrow + 1.day
e.save!
end
Event.stub(:search_and_filter, MockSearch.new(my_events)) do
with_settings({ site: { home_page: { upcoming_events: 5 } } }) do
get :home
assert_select 'section#upcoming_events', count: 1
assert_select 'section#upcoming_events h2', count: 1
assert_select 'section#upcoming_events .link-overlay', count: 2
end
end
end
test 'should show latest materials' do
my_materials = [materials(:good_material), materials(:interpro)]
Material.stub(:search_and_filter, MockSearch.new(my_materials)) do
with_settings({ site: { home_page: { latest_materials: 5 } } }) do
get :home
assert_select 'section#latest_materials', count: 1
assert_select 'section#latest_materials h2', count: 1
assert_select 'section#latest_materials .link-overlay', count: 2
end
end
end
test 'should show featured trainer' do
with_settings({ site: { home_page: { featured_trainer: true } } }) do
get :home
assert_select 'section#featured_trainer', count: 1
assert_select 'section#featured_trainer h2', count: 1
assert_select 'section#featured_trainer li', count: 1
end
end
test 'should show event counts in counter blocks' do
Event.destroy_all
user = users(:regular_user)
11.times do |i|
Event.create(title: "Event #{i}", url: "https://events.com/event##{i}",
start: Time.zone.now + 1.week, end: Time.zone.now + 1.week + 8.hours, user: user)
end
with_settings({ site: { home_page: { counters: true } } }) do
get :home
assert_select 'div#resource_count', text: '11', count: 1
end
end
test 'should show provider grid' do
mock_images
ContentProvider.destroy_all
regular = users(:regular_user)
unverified = users(:unverified_user)
regular_provider = regular.content_providers.create!(title: 'Regular Provider',
image_url: 'http://example.com/goblet.png',
url: 'https://providers.com/p1')
another_provider = regular.content_providers.create!(title: 'Another Regular Provider',
image_url: 'http://example.com/goblet.png',
url: 'https://providers.com/p3')
with_settings({ site: { home_page: { provider_grid: true } } }) do
get :home
assert_select 'section#content_providers_grid', count: 1
assert_select 'section#content_providers_grid li.provider-grid-tile', count: 2
end
end
test 'should show community banner if matching community for country' do
Locator.instance.stub(:lookup, { 'country' => { 'iso_code' => 'GB', 'names' => { 'en' => 'United Kingdom' } } }) do
with_settings({ site: { home_page: { communities: true } } }) do
get :home
assert_response :success
assert_select '#community-banner', text: /Visit the UK training portal to browse local training./
end
end
end
test 'should not show community banner if no matching community for country' do
Locator.instance.stub(:lookup, { 'country' => { 'iso_code' => 'SE', 'names' => { 'en' => 'Sweden' } } }) do
with_settings({ site: { home_page: { communities: true } } }) do
get :home
assert_response :success
assert_select '#community-banner', count: 0
end
end
end
test 'should not show community banner if feature disabled' do
Locator.instance.stub(:lookup, { 'country' => { 'iso_code' => 'GB', 'names' => { 'en' => 'United Kingdom' } } }) do
with_settings({ site: { home_page: { communities: false } } }) do
get :home
assert_response :success
assert_select '#community-banner', count: 0
end
end
end
test 'should not show registration button if disabled for country' do
with_settings({ blocked_countries: ['gb'] }) do
Locator.instance.stub(:lookup, { 'country' => { 'iso_code' => 'GB' } }) do
get :home
assert_response :success
assert_select '.dropdown-item a', text: 'Register', count: 0
end
Locator.instance.stub(:lookup, { 'country' => { 'iso_code' => 'FR' } }) do
get :home
assert_response :success
assert_select '.dropdown-item a', text: 'Register', count: 1
end
end
end
test 'should not find header-notice when header_notice is disabled' do
with_settings({ header_notice: '' }) do
get :home
assert_select 'nav.header-notice', count: 0
end
end
test 'should find header-notice when header_notice is enabled' do
with_settings({ header_notice: 'Test' }) do
get :home
assert_select 'nav.header-notice', count: 1
end
end
test 'should not find sticky-navbar-enabled when sticky_navbar is disable' do
with_settings({ feature: { sticky_navbar: false } }) do
get :home
assert_select 'body.sticky-navbar-enabled', count: 0
end
end
test 'should find sticky-navbar-enabled when sticky_navbar is enabled' do
with_settings({ feature: { sticky_navbar: true } }) do
get :home
assert_select 'body.sticky-navbar-enabled', count: 1
end
end
test 'sets current space based on subdomain' do
get :home
assert_equal 'TTI', Space.current_space.title
with_host('plants.mytess.training') do
get :home
assert_equal 'TeSS Plants Community', Space.current_space.title
end
end
test 'does not set space if spaces feature disabled' do
with_host('plants.mytess.training') do
with_settings({ feature: { spaces: false } }) do
get :home
assert_equal 'TTI', Space.current_space.title
end
end
end
test 'should allow configuration of custom links in footer' do
site_settings = TeSS::Config.site.dup
site_settings['footer'] = nil
with_settings({ site: site_settings }) do
get :home
assert_select 'footer', count: 1
assert_select 'a[href="https://example.org/"]', count: 0
assert_select 'a[href="https://example.org/l"]', count: 0
assert_select 'a[href="https://example.org/c"]', count: 0
assert_select 'a[href="https://example.org/r"]', count: 0
end
site_settings['footer'] = {
'additional_links': [
{
'url': 'https://example.org/',
'title': 'My Example Link'
},
{
'url': 'https://example.org/l',
'title': 'Left Example Link',
'location': 'left'
},
{
'url': 'https://example.org/c',
'title': 'Center Example Link',
'location': 'center'
},
{
'url': 'https://example.org/r',
'title': 'Right Example Link',
'location': 'right'
}
]
}
with_settings({ site: site_settings }) do
get :home
assert_select 'footer .row > div:nth-of-type(1)' do
assert_select 'a[href="https://example.org/l"]', 'Left Example Link'
end
assert_select 'footer .row > div:nth-of-type(2)' do
assert_select 'a[href="https://example.org/"]', 'My Example Link'
end
assert_select 'footer .row > div:nth-of-type(2)' do
assert_select 'a[href="https://example.org/c"]', 'Center Example Link'
end
assert_select 'footer .row > div:nth-of-type(3)' do
assert_select 'a[href="https://example.org/r"]', 'Right Example Link'
end
end
end
test 'should find log in drop down when login_through_oidc_only is disabled' do
with_settings({ feature: { login_through_oidc_only: false } }) do
get :home
assert_select 'ul.user-options.nav.navbar-nav.navbar-right' do
assert_select 'a.dropdown-toggle', count: 1
end
end
end
test 'should find log in button when login_through_oidc_only is enabled' do
Devise.stub( :omniauth_configs, { oidc: OpenStruct.new(options: { label: "OIDC" }) }
) do
with_settings({ feature: { login_through_oidc_only: true } }) do
get :home
assert_select 'ul.user-options.nav.navbar-nav.navbar-right' do
assert_select 'a[href="/users/auth/oidc"]', count: 1
end
end
end
end
test 'should respect space disabled_features when displaying tabs' do
space = spaces(:plants)
space.disabled_features = ['events', 'materials']
space.save!
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features) do
with_host('plants.mytess.training') do
get :home
# These should NOT appear because they're disabled for this space
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', events_path, count: 0
assert_select 'li a[href=?]', materials_path, count: 0
end
# These should still appear because they're not disabled
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', collections_path
end
end
end
end
test 'space disabled_features do not affect default space' do
space = spaces(:plants)
space.disabled_features = ['events', 'materials']
space.save!
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features) do
# Access the default space (not plants)
get :home
# All features should appear in the default space
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', materials_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', collections_path
end
end
end
test 'different spaces can have different disabled features' do
plants_space = spaces(:plants)
plants_space.disabled_features = ['events']
plants_space.save!
astro_space = spaces(:astro)
astro_space.disabled_features = ['materials']
astro_space.save!
features = {
'events': true,
'materials': true,
'workflows': true,
'spaces': true
}
with_settings(feature: features) do
# Check plants space - events disabled
with_host('plants.mytess.training') do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', events_path, count: 0
assert_select 'li a[href=?]', materials_path
assert_select 'li a[href=?]', workflows_path
end
end
# Check astro space - materials disabled
with_host('space.mytess.training') do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', materials_path, count: 0
assert_select 'li a[href=?]', workflows_path
end
end
end
end
test 'space with no disabled features shows all enabled global features' do
space = spaces(:plants)
space.disabled_features = []
space.save!
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features) do
with_host('plants.mytess.training') do
get :home
# All globally enabled features should appear
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', about_path
assert_select 'li a[href=?]', events_path
assert_select 'li a[href=?]', materials_path
assert_select 'li a[href=?]', elearning_materials_path
assert_select 'li a[href=?]', workflows_path
assert_select 'li a[href=?]', collections_path
end
end
end
end
test 'space disabled features work with directory tabs' do
space = spaces(:plants)
space.disabled_features = ['content_providers']
space.save!
features = {
'events': true,
'materials': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
with_settings(feature: features, site: { tab_order: [], directory_tabs: ['content_providers', 'trainers', 'nodes'] }) do
with_host('plants.mytess.training') do
get :home
# content_providers should not appear even in directory menu
assert_select 'li.dropdown.directory-menu' do
assert_select 'li a[href=?]', content_providers_path, count: 0
assert_select 'li a[href=?]', trainers_path
assert_select 'li a[href=?]', nodes_path
end
end
end
end
test 'space enabled features are limited by instance enabled features' do
space = spaces(:plants)
space.disabled_features = []
space.save!
assert_includes space.enabled_features, 'events'
with_settings(feature: { 'events': false }) do
with_host('plants.mytess.training') do
get :home
assert_select 'ul.nav.navbar-nav' do
assert_select 'li a[href=?]', materials_path, count: 1
assert_select 'li a[href=?]', events_path, count: 0
end
end
end
end
test 'disabled features do not show as counters on space front page' do
space = spaces(:plants)
space.disabled_features = ['materials']
space.save!
with_host('plants.mytess.training') do
get :home
end
assert_select '.resource-counter a[href=?]', materials_path, count: 0
assert_select '.resource-counter a[href=?]', events_path, count: 1
end
test 'can disable spaces index from directory, but it still shows up in the footer' do
space = spaces(:plants)
space.disabled_features = ['spaces']
space.save!
with_settings(feature: { 'events': false }) do
with_host('plants.mytess.training') do
get :home
assert_select 'ul.nav.navbar-nav li a[href=?]', spaces_path, count: 0
assert_select '.footer-item a[href=?]', spaces_path, count: 1
end
end
end
end