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

Add API for managing aliases of `describe` #493

Closed
dchelimsky opened this Issue Nov 1, 2011 · 3 comments

Comments

Projects
None yet
3 participants
@dchelimsky
Member

dchelimsky commented Nov 1, 2011

rspec-core has configuration APIs for managing aliases for example (e.g. it) and shared_examples (e.g. it_behaves_like), but there is no such API for managing aliases for describe (which should be renamed to example_group and then aliased as describe and context).

As of 2.7, describe is available at all levels, but context is only available within an example group declaration.

I'd propose something along the lines of this:

RSpec.configure do |c|
  c.alias_example_group_to :describe, :top_level => true
  c.alias_example_group_to :context, :top_level => false
end

We should also be able to turn off all top-level names if we want, so users concerned with describe, context, et al bleeding into their code can say:

RSpec.describe Thing do
  it "does something"
end
@samwgoldman

This comment has been minimized.

Show comment
Hide comment
@samwgoldman

samwgoldman Nov 1, 2011

Contributor

Would this allow the aliases to define custom behavior? It doesn't look like it would be possible. I'm thinking along the lines of how capybara/rpsec adds metadata when defining it's feature method.

Contributor

samwgoldman commented Nov 1, 2011

Would this allow the aliases to define custom behavior? It doesn't look like it would be possible. I'm thinking along the lines of how capybara/rpsec adds metadata when defining it's feature method.

@dchelimsky

This comment has been minimized.

Show comment
Hide comment
@dchelimsky

dchelimsky Nov 1, 2011

Member

@samwgoldman - yes, that would be the idea. Otherwise it adds zero value over alias

Member

dchelimsky commented Nov 1, 2011

@samwgoldman - yes, that would be the idea. Otherwise it adds zero value over alias

@myronmarston

This comment has been minimized.

Show comment
Hide comment
@myronmarston

myronmarston Apr 11, 2013

Member

Now that we have a PR (#870), I'm going to close this to focus discussion there.

Member

myronmarston commented Apr 11, 2013

Now that we have a PR (#870), I'm going to close this to focus discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment