Skip to content

Can't find Ruby step definitions when using Turnip: it defines with step, not Given or When etc.Β #317

Description

@henrahmagix

πŸ‘“ What did you see?

Undefined step, when the step is defined and the tests run just fine:
Image

module FeatureSteps
  step "I am logged in" do
    login(@user)
  end
  # ...
end

βœ… What did you expect to see?

Step definition is found by the language service:
Image

πŸ“¦ Which tool/library version are you using?

ruby 3.4.7
turnip 4.4.1 (latest)
Cucumber extension 1.11.0 (latest)

# Gemfile.lock
    cucumber-gherkin (32.1.2)
      cucumber-messages (> 25, < 28)
    cucumber-messages (27.2.0)
    cuke_modeler (3.24.0)
      cucumber-gherkin (< 33.0)
    rspec (3.13.1)
      rspec-core (~> 3.13.0)
      rspec-expectations (~> 3.13.0)
      rspec-mocks (~> 3.13.0)
    turnip (4.4.1)
      cuke_modeler (~> 3.15)
      rspec (>= 3.0, < 4.0)

πŸ”¬ How could we reproduce it?

  1. setup a base Ruby repo, with bundler
  2. bundle add turnip
  3. setup rspec + turnip:
    $ bundle exec rspec --init
    $ echo '--require turnip/rspec' >> .rspec
    $ echo '--require steps' >> .rspec
    $ cat <<'EOF' > spec/steps.rb
    RSpec.configure { |config| config.include(FeatureSteps, type: :feature) }
    module FeatureSteps
      step "I am logged in" do
        puts "TODO: log in"
      end
    end
    EOF
    
  4. make a feature file:
    $ cat <<'EOF' > spec/features/example.feature
    Feature: example
    
      Scenario: logged in
        Given I am logged in
    EOF
    
  5. configure Cucumber VS Code extension:
    "cucumber.features": [
      "spec/**/*.feature",
      "features/**/*.feature",
    ],
    "cucumber.glue": [
      "*spec/support/*.rb",
      "*features/**/*.rb",
    ]
  6. view the feature file in VS Code: code spec/features/example.feature

πŸ“š Any additional context?

Fixed (hopefully) in cucumber/language-service#297, similar to #233

Thanks in advance ☺️
Henry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions