Metadata (key-value) support for ActiveSupport::TestCase.test
method.
require 'active_support/testing/metadata'
class IntegrationTest < ActionDispatch::IntegrationTest
def setup
if metadata[:js]
Capybara.current_driver = Capybara.javascript_driver
else
Capybara.current_driver = Capybara.default_driver
end
end
test 'without js' do
# write test without js
end
test 'with js', js: true do
# write test with js
end
end
Add this line to your application's Gemfile:
gem 'activesupport-testing-metadata'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activesupport-testing-metadata
- Fork it ( https://github.com/y-yagi/activesupport-testing-metadata/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