require "test_helper" class OrganizationsControllerTest < ActionDispatch::IntegrationTest test "sport filter is a dropdown of values already in the project" do login_as users(:admin) create_campaign_org(name: "Futsal Test", email: "futsal@example.com", sport: "Calcio a 5") get organizations_path(project_code: "matchlivetv") assert_response :success assert_select "select[name=sport]" do assert_select "option[value='']", text: "Sport" assert_select "option[value=Calcio]", text: "Calcio" assert_select "option[value='Calcio a 5']", text: "Calcio a 5" end assert_select "input[name=sport]", count: 0 end test "sport filter keeps only organizations of that sport" do login_as users(:admin) create_campaign_org(name: "Futsal Test", email: "futsal@example.com", sport: "Calcio a 5") get organizations_path(project_code: "matchlivetv", sport: "Calcio a 5") assert_response :success assert_match(/Futsal Test/, response.body) assert_no_match(/ASD Test Calcio/, response.body) assert_select "select[name=sport] option[value='Calcio a 5'][selected]" end test "index table uses campaign spreadsheet columns" do login_as users(:admin) get organizations_path(project_code: "matchlivetv") assert_response :success %w[N. Regione Prov. Società Email\ verificata Streaming\ rilevato Evidenza\ /\ fit\ commerciale Stato\ invio Fonte\ contatto\ /\ ricerca Note\ follow-up].each do |header| assert_select "th", text: header end assert_select "th", text: "Organizzazione", count: 0 end end