Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Add additional rdoc example for ordering #2248

Merged
merged 1 commit into from
Jun 1, 2016

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented May 31, 2016

No description provided.

# @example
# RSpec.configure do |rspec|
# rspec.register_ordering :global do |examples|
# acceptance, other = examples.paritition do |example|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/paritition/partition/

@JonRowe JonRowe force-pushed the improve_ordering_documentation branch 3 times, most recently from fc8ea09 to d584f0e Compare May 31, 2016 06:48
@myronmarston
Copy link
Member

In the future, please write an example snippet like this in a real project and copy it in so you've actually demonstrated it working, @JonRowe. Simple mistakes like you had here are easy for anyone to do, but we do our users a disservice if we merge broken example code in our docs.

@JonRowe
Copy link
Member Author

JonRowe commented May 31, 2016

Apologies I did this last night then forgot to check it over, it actually is a snippet from a real project, I had just over simplified it. FYI the original was:

  config.register_ordering :global do |examples|
    api, rest = examples.partition { |ex| ex.metadata[:api] }
    app, rest = rest.partition { |ex| ex.metadata[:app] }
    randomiser = config.ordering_manager.ordering_registry.fetch(:random)

    [rest, api, app].inject([]) do |specs, more|
      specs += randomiser.order(more)
    end
  end

# Sets the default global order and, if order is `'rand:<seed>'`, also
# sets the seed.
# Sets the default global ordering strategy. By default this can be one
# of `:defined`, `:random`, but is customisable through the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've tend to use the American spelling with a z:

➜  repos git:(master) ack customize | wc -l
      65
➜  repos git:(master) ack customise | wc -l
       2

Mind spelling it with a z for consistency?

@rspec rspec locked and limited conversation to collaborators May 31, 2016
@rspec rspec unlocked this conversation May 31, 2016
@JonRowe JonRowe force-pushed the improve_ordering_documentation branch from d584f0e to e314934 Compare May 31, 2016 12:03
@JonRowe
Copy link
Member Author

JonRowe commented May 31, 2016

@myronmarston I double checked it rendered correctly
screen shot 2016-05-31 at 22 03 30

@myronmarston
Copy link
Member

@JonRowe this LGTM apart from the build failure. I (hopefully) have a fix for the build in #2249 -- maybe you can merge that, rebase this on top, and merge this when it goes green?

@myronmarston
Copy link
Member

@JonRowe -- I merged #2248. Want to rebase this to see if it'll go green?

@JonRowe JonRowe force-pushed the improve_ordering_documentation branch from e314934 to b6a675c Compare May 31, 2016 23:39
@JonRowe JonRowe merged commit 474db03 into master Jun 1, 2016
@JonRowe JonRowe deleted the improve_ordering_documentation branch June 1, 2016 00:27
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants