Sha256: 9d2e384e1920be67a6548c9c1a7ee777efcbf86c44ccb4e1cc2acc9087a3695b

Contents?: true

Size: 556 Bytes

Versions: 15

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  sequence :practice_code do |n|
    "M#{n.to_s.rjust(5, '0')}"
  end

  factory :practice, class: "Renalware::Patients::Practice" do
    name { "Trumpton Medical Centre" }
    email { "admin@trumptonmedicalcentre-nhs.net" }
    code { generate(:practice_code) }

    # ensures addressable_type and addressable_id work is assigned, using
    # FactoryBot's simple assoc method does not work
    #
    before(:create) do |practice|
      practice.build_address(attributes_for(:address))
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
renalware-core-2.1.1 spec/factories/patients/practices.rb
renalware-core-2.1.0 spec/factories/patients/practices.rb
renalware-core-2.0.167 spec/factories/patients/practices.rb
renalware-core-2.0.166 spec/factories/patients/practices.rb
renalware-core-2.0.165 spec/factories/patients/practices.rb
renalware-core-2.0.164 spec/factories/patients/practices.rb
renalware-core-2.0.163 spec/factories/patients/practices.rb
renalware-core-2.0.162 spec/factories/patients/practices.rb
renalware-core-2.0.161 spec/factories/patients/practices.rb
renalware-core-2.0.160 spec/factories/patients/practices.rb
renalware-core-2.0.159 spec/factories/patients/practices.rb
renalware-core-2.0.158 spec/factories/patients/practices.rb
renalware-core-2.0.157 spec/factories/patients/practices.rb
renalware-core-2.0.156 spec/factories/patients/practices.rb
renalware-core-2.0.155 spec/factories/patients/practices.rb