Inserts a middleware at the top of the stack that stops further requests and waits for in-flight requests to complete before proceeding. This is helpful for Capybara full-stack tests where AJAX requests still in-flight interfere with test tear-down. Based on "Tearing Down Capybara Tests of AJAX Pages" by Joel Turkel at Salsify.
Add these lines to your application's Gemfile:
group :test do
gem "rack_request_blocker"
end
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack_request_blocker
Add the following line to your spec_helper.rb
file:
require "rack_request_blocker/rspec"
That's it.
- Fork it ( https://github.com/[my-github-username]/rack_request_blocker/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request