Tag Archives: tests

Misc Rails Integration Test Tips

I attended an Automated Testing meetup yesterday. In my experience, integration tests turn your speedy test suite into a slowpoke. Here are some different tips and gems to consider using in your tests:

  • rack_session_access Gem
    Instead of making a user log in with capybara, why not set the user_id in the session. This gem sounds amazing.
  • fuubar Gem
    Another way to format your test results. Perhaps you’d like to use a progress slider.
  • rspec-retry Gem
    If a test does not pass on the first try, you can run it again until it passes. This feels like a code smell. In the meetup, the speaker mentioned that they were running their tests against live web requests (instead of pre-recorded requests).
  • Page Objects
    Capybara syntax seemsĀ procedural since you are telling it to visit a path and click on things. With page objects, you can have DRY code that abstracts away all the step by step page interactions with something like [cci]ProjectPageObject.create[/cci]
  • View Tests
    Instead of doing full blown integration (feature) testing that uses a browser, you can try view tests that assert things are found on your page.

Hopefully you can use some of these tips to improve your test suite.