FactoryGirl.define do
  factory :subscription_line_item, class: 'SolidusSubscriptions::LineItem' do
    subscribable_id 1
    quantity 1
    interval 30.days

    association :spree_line_item, factory: :line_item

    trait :with_subscription do
      transient do
        subscription_traits []
      end

      subscription { build :subscription, *subscription_traits }
    end
  end
end

FactoryGirl.define do
  factory :subscription_line_item, class: 'SolidusSubscriptions::LineItem' do
    subscribable_id { create(:variant, subscribable: true).id }
    quantity 1
    interval 30.days

    association :spree_line_item, factory: :line_item

    trait :with_subscription do
      transient do
        subscription_traits []
      end

      subscription { build :subscription, *subscription_traits }
    end
  end
end

Create an actual subscribable in factory
Create an actual subscribable in factory

Instead of a random id, actually create the subscribable variant
