h7caya
Last Updated: February 25, 2016
·
245
· idrozd

Rails test suite acting strange - type macthing fails

If you have dummy classes defined in your examples, and your test suite contains, for example, capybara features, which are dropping code on each run, leading to mandelbugs

The way to debug this is to add snippet similar to following to spec_helper:

module ActiveSupport::Dependencies
  def clear_with_caller
    puts 'CLEARING!', SomeProblematicClass.object_id, caller
    clear_without_caller
  end
  alias_method_chain :clear, :caller
end

And then you can grep your test suite output:

   rspec --seed [failing_seed] | grep CLEARING -A 20
# or
   rspec --seed [failing_seed] | less # /CLEARING