Search code examples
rubyrspeccucumberrubymine

Cucumber. How to enable code completion for RSpec assertions in RubyMine


I use Cucumber with Rspec assertions.

Their documentation says:

Add the rspec-expectations gem to your Gemfile. Cucumber will automatically load RSpec’s matchers and expectation methods to be available in your step definitions.

It works fine but RubyMine 2020.1 can't recognize RSpec and code autocompletion in steps definition doesn't work as expected:

Given /^a nice new bike$/ do
  expect(@bikes).to have_key("new")
end

IDE doesn't suggest expect when I start typing exp... and have_key is underlined with a warning Cannot find have_key. Is it possible to make this feature work?


Solution

  • At the moment RubyMine doesn't have support for it. Please add your vote and follow the corresponding request:

    https://youtrack.jetbrains.com/issue/RUBY-26444