2013-10-05 64 views

回答

1

我会推荐通过水豚和黄瓜的代码追踪(理想情况下为您使用的宝石版本)。我发现从Capybara启动服务器的地方开始向后工作比从Cucumber启动的时候开始更容易。

Capybara::Server是负责启动服务器的类。

Capybara::Session creates an instance of Capybara::Server

将您的驱动程序设置为:当Capybara#current_session creates a new instance of Capybara::Session使用webkit时,会使用webkit。

page, a method in Capybara's DSL, just returns current_session

所有的DSL方法,如visitget sent to the current_session through page。在DSL文件的顶部,有一条评论说"When using capybara/dsl, the Session is initialized automatically for you."

通过使用黄瓜栏或by manually requiring capybara/cucumber,您将获得capybara DSL methods included in Cucumber's World

我在一段时间内没有使用黄瓜,但我想我记得他们从黄瓜中移除了任何预先填充的步骤定义,所以实际上没有任何地方可以考虑链接到黄瓜的代码中,但第一个当一个步骤定义调用一个Capybara DSL方法时,就像服务器启动时一样。

相关问题