How can I include javascript with javascript_include_tag at the top of the page for a capybara test
问题 I am trying to test one javascript class in a spec test with capybara. I have static page player.haml in which I am loading the javascript class definition with javascript_include_tag. It looks like that .container = javascript_include_tag "../player" #player My test looks like that it 'can autoplay a video' do visit player_path video = Fabricate(:video) options = { autoplay: true, ... } page.execute_script("var options = '#{options}'; videoId = '#{video.id}'; var player = new Player(videoId,