开发者

Rails capybara cucumber before each test support

开发者 https://www.devze.com 2023-04-03 22:53 出处:网络
I\'m using cucumber and capybara to do our ATs and I\'m trying to replace celerity/culerity with webkit and I\'m wondering if anyone knows of a way to have each scenario run a method (the same method开

I'm using cucumber and capybara to do our ATs and I'm trying to replace celerity/culerity with webkit and I'm wondering if anyone knows of a way to have each scenario run a method (the same method开发者_如何学Go) before executing each test. Something along the lines of before :each...


Would you consider using RSpec / Capybara?

I know you asked about Cucumber / Capybara but I recently switched over from Cucumber / Capybara to Rspec / Capybara for integration tests and have found it really intuitive.

If you are open to trying it out, you should be able to configure it in your spec_helper like so:

  config.around(:each) do |example|
    your_method    
    example.run
  end

You can also tag particular specs as well:

  config.around(:each, :your_tag => true) do |example|
    your_method
    example.run
  end
0

精彩评论

暂无评论...
验证码 换一张
取 消