Cucumber::Rails::World

[quote][b]runs each scenario in an isolated DB transaction.[/b][/quote]
Cucumber::Rails::World
Cucumber::Rails::World is the bridge between Cucumber and
Rails. It provides the Rails integration testing methods within
each scenario.
When Cucumber’s Rails support is loaded by requiring cucum-
ber/rails/world in features/support/env.rb, instances of Cucum-
ber::Rails::World are configured to be the World for each sce-
nario:
World do
Cucumber::Rails::World.new
end
inherits Rails’
Cucumber::Rails::World ActionCon-
troller::IntegrationTest, and makes surprisingly few modifications to
the superclass behaviour. Each scenario is run in a newly instan-
tiated Cucumber::Rails::World. This gives us access to all of the
functionality of Rails’ Integration tests and RSpec’s Rails-specific
matchers, including simulating requests to the application and
specifying behaviour with RSpec expectations.
In the default configuration, it runs each scenario in an isolated
DB transaction. You can disable this by removing the following
line from the features/support/env.rb generated by Cucumber:
Cucumber::Rails.use_transactional_fixtures
If you disable per-scenario transactions, you’ll have to worry
about records left over from one scenario affecting the results
of the next. This often leads to inadvertent and subtle order-
ing dependencies in your scenario build. For these reasons, we
strongly recommend using the transactional fixtures setting.∗
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值