Tag: rails

  • rspec-rails tricks: Hacking Your Routes for a Spec

    I don’t know that this is so much a reminder of “What can be done with rspec-rails” as a note that, “If you do this will rspec-rails, you will also need to undo it.” Today’s note: If you hack the application routes for a controller test, you have to reload routes. The original problem This…

  • Multiple Postgres Schemas and Rails db:test:prepare

    In our Rails databases, we use multiple Postgres schemas. This is partly for partitioning archive data from fresh data. On a new Rails 5 project, I started having tests fail once the models had the “archivable” concern added, which depended on an archive schema existing. Ultimately, the problem is that the archive schema wasn’t being…

  • RailsSettings vs parallel_tests

    RailsSetting stubbing problem I have an area of functionality that is controlled by a Settings class that is a subclass of RailsSettings::CachedSettings (rails-settings-cached gem) and changing that setting for tests was interfering with the parallel_tests gem when I ran my rspec tests. I tried namespacing the cache, making TTL 0, invalidating the cache, monkeypatching the…