@@ -587,13 +587,25 @@ class ContentProvidersControllerTest < ActionController::TestCase
587587 new_material = Material . create! ( title : 'my_material' , description : 'visible material' , url : 'http://new.url.com' , content_provider : @content_provider , user : @content_provider . user )
588588 get :show , params : { id : @content_provider }
589589 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"
591593 assert_select '.masonry-brick-heading h4' , text : 'my_material'
592594 new_material . visible = false
593595 new_material . save!
594596 get :show , params : { id : @content_provider }
595597 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"
597599 assert_select '.masonry-brick-heading h4' , text : 'my_material' , count : 0
598600 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
599611end
0 commit comments