Category: ruby

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

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

  • Rails 4, phantom ArgumentError: wrong number of arguments (0 for 1) on UserSession.find for AuthLogic

    This was a total pain to locate, as the exceptions being raised were pointed to UserSession.find in Authlogic::Session::Persistence. gems in question: activerecord-session_store 0.1.1 authlogic 3.4.6 activerecord 4.2.3 rails 4.2.3 I noticed that the only meaningful difference between the two environments was the following instance variable in Rails.application.config: irb> pp Rails.application.config . . . @logger= #…