Method: RSpec::Core::Configuration#alias_example_group_to

Defined in:
lib/rspec/core/configuration.rb

#alias_example_group_to(new_name, *args) ⇒ void

Note:

The defined aliased will also be added to the top level (e.g. main and from within modules) if expose_dsl_globally is set to true.

Creates a method that defines an example group with the provided metadata. Can be used to define example group/metadata shortcuts.

Examples:

RSpec.configure do |config|
  config.alias_example_group_to :describe_model, :type => :model
end

shared_context_for "model tests", :type => :model do
  # define common model test helper methods, `let` declarations, etc
end

# This lets you do this:

RSpec.describe_model User do
end

# ... which is the equivalent of

RSpec.describe User, :type => :model do
end

See Also:



1209
1210
1211
1212
# File 'lib/rspec/core/configuration.rb', line 1209

def alias_example_group_to(new_name, *args)
  extra_options = Metadata.build_hash_from(args)
  RSpec::Core::ExampleGroup.define_example_group_method(new_name, extra_options)
end