Method: RSpec::Core::Configuration#alias_example_to

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

#alias_example_to(name, *args) ⇒ Object

Note:

The specific example alias below (`pending`) is already defined for you.

Note:

Use with caution. This extends the language used in your specs, but does not add any additional documentation. We use this in RSpec to define methods like `focus` and `xit`, but we also add docs for those methods.

Creates a method that delegates to `example` including the submitted `args`. Used internally to add variants of `example` like `pending`:

Examples:

RSpec.configure do |config|
  config.alias_example_to :pending, :pending => true
end

# This lets you do this:

describe Thing do
  pending "does something" do
    thing = Thing.new
  end
end

# ... which is the equivalent of

describe Thing do
  it "does something", :pending => true do
    thing = Thing.new
  end
end

1073
1074
1075
1076
# File 'lib/rspec/core/configuration.rb', line 1073

def alias_example_to(name, *args)
  extra_options = .build_hash_from(args)
  RSpec::Core::ExampleGroup.define_example_method(name, extra_options)
end