module SpecControllerHelpers
  def setup_supplier_for_controller(manager: true)
    @employee = create :employee, :confirmed
    options = {employee_ids: [@employee.id]}
    options[:employee_settings_storage] = {@employee.id => {'manager' => true}} if manager
    @supplier = Supplier.find_by_name('Suppy') || create(:supplier, :open, options)
    @request.env["devise.mapping"] = Devise.mappings[:employee]
    sign_in @employee
  end
end
