FAQ / knapsack_pro / Queue Mode problems & solutions for knapsack_pro gem

Why when I use Queue Mode for RSpec then I see error superclass mismatch for class?

You may see error like:

TypeError:
  superclass mismatch for class BatchClass

when you have 2 test files like this one:


# spec/a_spec.rb
class BaseBatchClass
end

module Mock
  module FakeModels
    class BatchClass < BaseBatchClass
      def args
      end
    end
  end
end

describe 'A test of something' do
  it do
  end
end

# spec/b_spec.rb
class DifferentBaseBatchClass
end

module Mock
  module FakeModels
    # Note the base class is different here!
    class BatchClass < DifferentBaseBatchClass
      def args
      end
    end
  end
end

describe 'B test of something' do
  it do
  end
end

Instead of mocking like shown above you could use RSpec stub_const to solve error superclass mismatch for class BatchClass.

# Queue Mode problems & solutions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.