Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Country factory states_required attribute #4272

Commits on Jul 6, 2022

  1. Fix Country factory states_required attribute

    Resolves issue: solidusio#4270
    
    Some tests were modified to give a state with the address parameters
    as they used a country which will now get the states_required attribute
    of true, meaning a state must be present on the address.
    RyanofWoods committed Jul 6, 2022
    Configuration menu
    Copy the full SHA
    cf84832 View commit details
    Browse the repository at this point in the history
  2. Wrap address_factory_spec in a context

    Improves the readability of the next commit.
    RyanofWoods committed Jul 6, 2022
    Configuration menu
    Copy the full SHA
    31dd14f View commit details
    Browse the repository at this point in the history
  3. Use nested Carmen regions if necessary for state factory

    For some countries such as Italy, its states are nested within regions,
    and not at the first level of subregions like 'US'.
    `country > region > states`
    `Carmen::Country.coded('IT').subregions.first.type`
    
    Now nested subregions exist, it will use this instead. This will be
    useful for when using the state factory, but also necessary for the
    upcoming commit, where if a state is not given, but a country is, for
    the address factory, it can automatically use/create the first state of
    that country.
    RyanofWoods committed Jul 6, 2022
    Configuration menu
    Copy the full SHA
    c3dd622 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2022

  1. Automatically create a state if necessary for address factory

    Two rationales for this change:
    1. Now that the states_required attribute is now functioning in the
      country factory, some specs for codebases might start breaking, due to
      them using an address factory, not giving a state, but using a country
      that requires a state. This should prevent many breaking tests *
    2. Less setup is now needed for specs. Only a state or country is needed
       for a valid non-US (default) address
    
    * But not all, for example address API endpoint specs might break, which
    happened for Solidus:
    cf84832
    RyanofWoods committed Jul 7, 2022
    Configuration menu
    Copy the full SHA
    bd8ad62 View commit details
    Browse the repository at this point in the history