@@ -587,13 +587,25 @@ class ContentProvidersControllerTest < ActionController::TestCase
587
587
new_material = Material . create! ( title : 'my_material' , description : 'visible material' , url : 'http://new.url.com' , content_provider : @content_provider , user : @content_provider . user )
588
588
get :show , params : { id : @content_provider }
589
589
assert_response :success
590
- assert_select '.search-results-count.my-3' , text : 'Showing 10 materials'
590
+ not_disabled_material_count = @content_provider . materials . not_disabled . length
591
+ assert not_disabled_material_count > 1
592
+ assert_select '.search-results-count.my-3' , text : "Showing #{ not_disabled_material_count } materials"
591
593
assert_select '.masonry-brick-heading h4' , text : 'my_material'
592
594
new_material . visible = false
593
595
new_material . save!
594
596
get :show , params : { id : @content_provider }
595
597
assert_response :success
596
- assert_select '.search-results-count.my-3' , text : ' Showing 9 materials'
598
+ assert_select '.search-results-count.my-3' , text : " Showing #{ not_disabled_material_count - 1 } materials"
597
599
assert_select '.masonry-brick-heading h4' , text : 'my_material' , count : 0
598
600
end
601
+
602
+ test 'should only show content for current space on show page' do
603
+ with_host ( 'plants.mytess.training' ) do
604
+ get :show , params : { id : @content_provider }
605
+ assert_select '.search-results-count.my-3' , text : 'Showing 1 material'
606
+ assert_select '.masonry-brick-heading h4' , text : 'Plant material'
607
+ assert_select '.search-results-count.my-3' , text : 'Showing 1 event'
608
+ assert_select '.masonry-brick-heading h4' , text : 'Learn about plants'
609
+ end
610
+ end
599
611
end
0 commit comments