Method: RSpec::Core::Configuration#alias_it_behaves_like_to

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

#alias_it_behaves_like_to(new_name, report_label = '') ⇒ void Also known as: alias_it_should_behave_like_to

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 it_should_behave_like (for backward compatibility), but we also add docs for that method.

Define an alias for it_should_behave_like that allows different language (like "it_has_behavior" or "it_behaves_like") to be employed when including shared examples.

Examples:

RSpec.configure do |config|
  config.alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
end

# allows the user to include a shared example group like:

RSpec.describe Entity do
  it_has_behavior 'sortability' do
    let(:sortable) { Entity.new }
  end
end

# which is reported in the output as:
# Entity
#   has behavior: sortability
#     ...sortability examples here


1240
1241
1242
# File 'lib/rspec/core/configuration.rb', line 1240

def alias_it_behaves_like_to(new_name, report_label='')
  RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
end