Including a module in a Capybara Minitest TestCase

61 views
Skip to first unread message

Mark Pitsilos

unread,
Apr 23, 2014, 12:45:02 PM4/23/14
to minites...@googlegroups.com
Hello,

I am trying to include a custom helper module in my test_helper.rb so that I don't need to do it per test.
However re-opening class ActionDispatch::IntegrationTest doesn't do the trick.

Instead I am reopening Capybara::Rails::TestCase to get it to work.

# FIXME: The following does not work
#class ActionDispatch::IntegrationTest
class Capybara::Rails::TestCase
  # Include support modules for features
  include FeatureHelpers
end

Any idea why my initial approach is not working and a cleaner approach to do this would be much appreciated.

Thanks in advance,

Mark

Andrew Evans

unread,
Jan 4, 2015, 3:21:02 AM1/4/15
to minites...@googlegroups.com
I know this is old, but for future Googlers...


Capybara is intended to be used for automating a browser to test your application's features. This is different than the integration tests that Rails provides, so you must use the Capybara::Rails::TestCase for your feature tests.

And further down:

 While not recommended, you can add Capybara to your integration tests. To do this add the following to your test_helper.rb file:
 
class ActionDispatch::IntegrationTest
  include Capybara::DSL
  include Capybara::Assertions
end
Reply all
Reply to author
Forward
0 new messages