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

Example groups can override the default ordering #1025

Merged
merged 31 commits into from
Oct 1, 2013

Commits on Sep 27, 2013

  1. Configuration menu
    Copy the full SHA
    7e11746 View commit details
    Browse the repository at this point in the history
  2. Example groups can override the default ordering.

    Also OrderingRegistry needs docs.
    alindeman authored and myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    a755aa6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e177c1d View commit details
    Browse the repository at this point in the history
  4. Combine ordering logic into one file.

    - There's no need for so many tiny files.
    - 1.9 has known perf issues with require,
      so doing one require instead of 4
      should speed up pert a bit.
    - This keeps the ordering logic all in one
      small (< 100 LOC) file.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    24c2889 View commit details
    Browse the repository at this point in the history
  5. Extract srand allowance.

    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    4564d11 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7e74b94 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f88f3c2 View commit details
    Browse the repository at this point in the history
  8. 2.0 shuffles differently.

    This spec failed on 2.0. This change makes it
    more resilient.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    54691e8 View commit details
    Browse the repository at this point in the history
  9. Refactor ordering registry.

    - Use two of them (one for examples, one for groups),
      rather than having a single one with separate,
      duplicated methods for examples vs groups.
    - Rename `resolve_example_ordering` to `#[]`. It has the
      semantics of a hash lookup, after all.
    - Add `global_ordering` for the case where that is
      explicitly needed.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    87760bd View commit details
    Browse the repository at this point in the history
  10. Change dependency injection of configuration.

    To me, it makes more sense to pass it to `Random.new`
    and to retain it as instance state on that object.
    Injecting it in the `order` method is a little odd,
    as it complicates the `#order` interface for all the
    other strategies, even those that don't use the
    configuration at all.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    60263d6 View commit details
    Browse the repository at this point in the history
  11. Improve expectation.

    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    cc318d0 View commit details
    Browse the repository at this point in the history
  12. Improve isolation of order specs.

    * Cleanup extra files created by individual specs.
    * Change to the aruba tmp dir before running the
      command.  This is important so that it doesn't
      pick up options in our `.rspec` file.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    65b735e View commit details
    Browse the repository at this point in the history
  13. Remove inconsistent #order and #randomize? config methods.

    * Examples and groups can be ordered differently.
    * Individual groups can be ordered differently.
    
    As such, a global `order` reader method doesn't
    make a lot of sense (although, assigning the global
    default via `#order=` still does, I think).
    
    Also:
    
    * This exposed that the ordering force logic
      (e.g. to ensure CLI `--order rand` takes
      precedence over `RSpec.configure`) didn't
      work properly since it simply ensured `order`
      returned the forced option but did not ensure
      the global ordering was set properly.  I've
      fixed this.
    * Don't clear the seed when setting the order to
      default. An individual example group may still
      be run in random order and will need the seed.
      There's really no reason to clear it.
    * Base our decision of whether or not to print
      the seed at the end of the run on whether or
      not the random strategy ever got used, rather
      than whether or not `random` is the global
      strategy. If only one example group used the
      random strategy we would want it to print,
      but the old logic would not have done so.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    fd994ab View commit details
    Browse the repository at this point in the history
  14. Refactor: extract Ordering::ConfigurationManager.

    There's enough ordering config options that
    they should be grouped into their own object.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    a1fb7e3 View commit details
    Browse the repository at this point in the history
  15. Refactor: refine how we pass config state to Reporter.

    It's more natural to just pass the config instance in
    the initializer, rather than passing the seed to
    `report` and referencing `RSpec.configuration`.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    d4e05fd View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7e94b81 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    537bfdd View commit details
    Browse the repository at this point in the history
  18. Use groups vs example strategy for groups vs examples.

    We were wrongly always using the example strategy
    for both groups and examples.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    06049c2 View commit details
    Browse the repository at this point in the history
  19. Improve formatting.

    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    a500b52 View commit details
    Browse the repository at this point in the history
  20. Change #[] to #fetch.

    For the case of an unrecognized order symbol,
    I want to have it take a fallback block
    (like the semantics of Hash#fetch), but #[]
    can't accept a block so we have to change the API.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    6e6f57b View commit details
    Browse the repository at this point in the history
  21. Print a warning when given an unrecognized :order option.

    Otherwise it may confuse users when they misspell the ordering.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    2f1d906 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    857b11b View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    61492dc View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    e7eaa57 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    69c12db View commit details
    Browse the repository at this point in the history
  26. Refactoring: use :global for global ordering.

    …rather than having special `set_global_ordering`
    and `global_ordering` methods.
    
    Also, simplify `Ordering::Registry#fetch`:
    
    - No need to handle `nil`; the caller can pass
      :global.
    - No need to handle callables; that's a bit of
      complexity we don't need. Callables can be
      registered.
    - No need to convert the ordering name `to_sym`;
      it wasn't spec'd and I'd rather require folks
      pass symbols.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    9b16f3e View commit details
    Browse the repository at this point in the history
  27. Simplify ordering API.

    - Don't have separate `groups`, `examples` and
      `groups_and_examples` methods. There are very
      few use cases for having separate logic for
      groups vs examples and it doesn't justify the
      added complexity to have separate APIs. If you
      need to order them separately, put a conditional
      in your ordering strategy that branches based on
      the type of the first item in the list.
    - Remove legacy `order_xyz` methods. These set the
      global ordering but didn't make that clear. Instead,
      the global ordering can be set by `register_ordering :global`.
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    10aca90 View commit details
    Browse the repository at this point in the history
  28. Rename --default ordering to --defined.

    `--default` was never a good name. (Consider that
    if we had made `--random` the default, `--default`
    would have been even more confusing).
    myronmarston committed Sep 27, 2013
    Configuration menu
    Copy the full SHA
    57ab90a View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2013

  1. Configuration menu
    Copy the full SHA
    c5979da View commit details
    Browse the repository at this point in the history
  2. Fix wonky indentation.

    myronmarston committed Oct 1, 2013
    Configuration menu
    Copy the full SHA
    6477ddf View commit details
    Browse the repository at this point in the history
  3. Remove unneeded code.

    myronmarston committed Oct 1, 2013
    Configuration menu
    Copy the full SHA
    df880f0 View commit details
    Browse the repository at this point in the history