class SampleAppearanceRelease < AppearanceRelease
  after_initialize do |record|
    # Set default values for any required attributes which are missing
    record.attributes = default_attrs.update(record.attributes.compact)
  end

  private

  def default_attrs
    {
      person_address_old: "Street Address, City, State Zipcode",
      person_address_street1: "St1",
      person_address_street2: "St2",
      person_address_city: "City",
      person_address_state: "State",
      person_address_zip: "ZIP",
      person_address_country: "Country",
      person_first_name:    "Some",
      person_last_name:     "Person",
      person_phone:   "555-555-5555",
      person_photo: sample_person_photo,
      signature: sample_signature,
    }
  end

  def sample_person_photo
    path = Rails.root.join("spec", "fixtures", "files", "person_photo.png")
    Rack::Test::UploadedFile.new(path, "image/png")
  end

  def sample_signature
    path = Rails.root.join("spec", "fixtures", "files", "signature.png")
    Rack::Test::UploadedFile.new(path, "image/png")
  end
end
