我定义了一个模块:
module Support
include Capybara::DSL
def self.do_something
click_link 'Questions'
end
end
它位于 features/support/support.rb
我的环境.rb:
require 'capybara'
require 'cucumber'
require 'capybara/cucumber'
Capybara.app_host = "http://www.stackoverflow.com"
Capybara.run_server = false
Capybara.default_driver = :selenium
我在steps.rb中调用模块的功能:
Support::do_something
我有一个例外:
undefined method `click_link' for Support:Module (NoMethodError)
如何使 Capybara 在支持模块中可用?