After watching a RailsConf video on ActionDispatch::systemTestCase, I was excited to incorporate it into my current app. Currently our test suite setup uses the following:
- rspec
- factory_girl
- capybara
# for feature specs
- database_cleaner
# for feature specs, mostly for testing js
- selenium-webdriver
# for feature specs
- capybara-webkit
# for feature specs
It was difficult to get the configuration working for our current setup, but we eventually got it working, thanks largely to an article by Avdi Grimm titled: Configuring database_cleaner with Rails, RSpec, Capybara, and Selenium.
My hope was to use the built-in system tests of rails released in rails 5.1
. Since rails now has system testing built in: all I would need to worry about configuring is the following:
rspec
factory_girl
And that is it because ActionDispatch::systemTestCase
takes care of capybara
, database_cleaner
, and it is already configured for the selenium
driver.
For example: currently my feature specs
are written like so (Capybara within the context of RSpec):
#spec/features/blogs/creating_blogs_spec.rb
require "rails_helper"
RSpec.feature "Logged in User can create a blog" do
before do
create(:logged_in_user)
end
scenario "successfully", js: true do
...
end
end
So this is what a typical integration/feature/system spec might look like for a test suite configured with rspec
, database_cleaner
, factory_girl
, and capybara
. I would like to convert it over to using ActionDispatch::systemTestCase
.
However: I would like to use ActionDispatch::systemTestCase
within the context of RSpec
.
The RailsConf video above shows how ActionDispatch::systemTestCase works within the context of rails' default test suite layout (ex: minitest with tests located in a test
directory), but it did not discuss how to use ActionDispatch::systemTestCase within the context of RSpec.
I could not find any resources on making rails' built-in system tests configurable with RSpec, including within the system testing section of the rails guides. Is this possible?