```ruby
attach_per_item_trait = proc do
  trait :per_item do
    transient { amount 1 }
    calculator { build(:calculator_per_item, preferred_amount: amount) }
  end
end

FactoryBot.modify do
  factory :payment_method, &attach_per_item_trait
  factory :shipping_method, &attach_per_item_trait
  factory :enterprise_fee, &attach_per_item_trait
end
```

Add flat rate calculator traits to related factories
user
```ruby
FactoryBot.define do
  factory :calculator_flat_rate, class: Spree::Calculator::FlatRate do
    preferred_amount { generate(:calculator_amount) }
  end
end

FactoryBot.modify do
  attach_calculator_traits = proc do
    trait :flat_rate do
      transient { amount 1 }
      calculator { build(:calculator_flat_rate, preferred_amount: amount) }
    end

    trait :per_item do
      transient { amount 1 }
      calculator { build(:calculator_per_item, preferred_amount: amount) }
    end
  end

  factory :payment_method, &attach_calculator_traits
  factory :shipping_method, &attach_calculator_traits
  factory :enterprise_fee, &attach_calculator_traits
end
```
assistant