Tag: testing

  • Referencing one trait from another trait in factory_bot

    Sometimes you want to DRY up traits by referencing one trait from another trait in factory_bot. I tried searching on “inheriting traits” (that’s just for one factory inheriting traits from another and was in a factory_bot issue in GitHub). I accidentally stumbled upon the answer in a slightly unrelated StackOverflow question about calling a trait…

  • 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…

  • Hooking in an LDAP Test Server to Cucumber Tests

    I managed to get a custom Devise strategy with LDAP working, but had no clear way of automating tests. I wanted to validate if I still had to keep the password fresh in the database, and needed to be able to write scenarios around that in case someone attempted to refactor out the code. After…