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

Add API for managing aliases of describe #493

@dchelimsky

Description

@dchelimsky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions