class RuboCop::Cop::RSpec::Dialect


end
# …
describe ‘display name presence’ do
# good
end
# …
context ‘display name presence’ do
# bad
@example
You can expect the following behavior:
feature: :describe
given!: :let!
given: :let
xscenario: :xit
scenario: :it
background: :before
PreferredMethods:
RSpec/Dialect:
native RSpec method (e.g. are just aliases), use the following config:
want to keep disabling all Capybara-specific methods that have the same
If you were previously using the ‘RSpec/Capybara/FeatureMethods` cop and
context: describe
PreferredMethods:
RSpec/Dialect:
a config like:
By default all of the RSpec methods and aliases are allowed. By setting
- expect, is_expected, expect_any_instance_of
- subject, subject!
- let, let!
- prepend_after, after, append_after
- around
- prepend_before, before, append_before,
- pending
- xit, xspecify, xexample, xscenario, skip
- fit, fspecify, fexample, fscenario, focus
- it, specify, example, scenario, its
- shared_examples, shared_examples_for, shared_context
- fdescribe, fcontext, ffeature
- xdescribe, xcontext, xfeature
- describe, context, feature, example_group
A dialect can be based on the following RSpec methods:
Enforces custom RSpec dialects.

def on_send(node)

def on_send(node)
  return unless rspec_method?(node)
  return unless preferred_methods[node.method_name]
  msg = format(MSG, prefer: preferred_method(node.method_name),
                    current: node.method_name)
  add_offense(node, message: msg) do |corrector|
    current = node.loc.selector
    preferred = preferred_method(current.source)
    corrector.replace(current, preferred)
  end
end