Using Cypress with Rails 6

Photo by Sophie Dale on Unsplash

Adding Cypress to the application

Let’s start adding Cypress and Axios to our full-stack Rails App;

ActiveRecord::Base.connection.execute("TRUNCATE #{table}")

Conclusion

If we want to test our Rails app with Cypress, we can’t use FactoryBot or transactional fixtures to accomplish two steps of the Four-Phase test(setup-exercise-verify-teardown) as we are able to do with RSpec/Selenium tests. So we had to improvise to take responsibility for our test database to behave in a transactional way.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Erbay

Ali Erbay

Full Stack Developer BDD/TDD || Ruby on Rails || React || React Native || NodeJS || Express https://github.com/kermit-klein