Capybara tests on a Rails Engine
If you have a Rails Engine you probably have a dummy app attached in test/dummy
or spec/dummy
to run and manual test the engine, right?
So you can use this dummy app to have some feature tests with capybara.
The trick is to change the RAILS_ROOT
to point to the correct file.
For cucumber tests add the following into features/support/env.rb
:
ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/../../spec/dummy')
For rspec tests add the following into spec/rails_helper.rb
:
ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/dummy')
Tweet