2015-07-05 66 views
0

我最近从RSpec切换到Minitest。我的模型测试都运行良好。但是,我的集成测试不再有效。have_content和have_selector不能与水豚和Minitest

我没有拨打have_contenthave_selector正在工作。

我已经包含Capybara::DSL在我test_helper.rb文件如下:

class ActionDispatch::IntegrationTest 
    include Rails.application.routes.url_helpers # for x_path and x_url helpers 
    include Capybara::DSL 
    include PossibleJSDriver # switching Capybara driver for javascript tests 

    def setup 
    end 

end 

下面是测试中的违规行:

page.should have_selector('ul.ui-autocomplete li.ui-menu-item a') 

和错误:

NoMethodError: undefined method `have_selector' for #<AppIntegrationTest:0x007f95f103afc8> 

我不不明白为什么这些不再工作。我正在使用minitest-rails-capybara宝石。

回答

2

Minitest中的语法不同。改为:

page.must_have_selector('ul.ui-autocomplete li.ui-menu-item a')