FactoryGirl.define do
  factory :address, aliases: [:bill_address, :ship_address], class: Spree::Address do
    firstname 'John'
    lastname 'Doe'
    company 'Company'
    address1 '10 Lovely Street'
    address2 'Northwest'
    city 'Herndon'
    zipcode '35005'
    phone '123-456-7890'
    alternative_phone '123-456-7899'

    state { |address| address.association(:state) }
    country do |address|
      if address.state
        address.state.country
      else
        address.association(:country)
      end
    end
  end
end

FactoryGirl.define do
  factory :address, aliases: [:bill_address, :ship_address], class: Spree::Address do
    firstname 'John'
    lastname 'Doe'
    company 'Company'
    address1 '10 Lovely Street'
    address2 'Northwest'
    city 'Herndon'
    zipcode '35005'
    phone '555-555-0199'
    alternative_phone '555-555-0199'

    state { |address| address.association(:state) }
    country do |address|
      if address.state
        address.state.country
      else
        address.association(:country)
      end
    end
  end
end

Address factory uses valid phone number.
Address factory uses valid phone number.

Area codes can not begin with 1, therefore the area code for this phone
number is invalid.

This causes issues for anyone who wishes to implement some level of
basic phone number validation, as if they use the address factory it
will cause their validations to fail.

fixes #5859
