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

Why when I use Queue Mode for RSpec then FactoryBot/FactoryGirl tests fail?

You can use knapsack_pro binary instead of rake task version to solve problem:


# knapsack_pro binary for Queue Mode
$ bundle exec knapsack_pro queue:rspec

Other solution is to check if your factories for FactoryBot/FactoryGirl use the same methods as Rake DSL and remove problematic part of the code.

The use of implicit association task can cause a problem.


# won't work in knapsack_pro Queue Mode
FactoryBot.define do
  factory :assignment do
    task
  end
end

Workaround is to replace task with explicit association:


# this will work in knapsack_pro Queue Mode
FactoryBot.define do
  factory :assignment do
    association :task
  end
end

# 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.