Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snippet with a string and Doc String generates a syntax error #1401

Closed
karamosky opened this issue Mar 19, 2020 · 1 comment
Closed

Snippet with a string and Doc String generates a syntax error #1401

karamosky opened this issue Mar 19, 2020 · 1 comment

Comments

@karamosky
Copy link
Member

karamosky commented Mar 19, 2020

Summary

When you have a step with a string argument and a Doc String argument, the generated snippet contains a duplicate argument name

Expected Behavior

Scenario: Snippet for undefined step with combined arguments
    Given a file named "features/undefined_steps.feature" with:
      """
      Feature:
        Scenario: combined step
          Given a "thing" with:
          \"\"\"
          thing
          \"\"\"
      """
    When I run `cucumber features/undefined_steps.feature -s`
    Then the output should contain:
      """
      Given('a {string} with:') do |string, string2|
        pending # Write code here that turns the phrase above into concrete actions
      end
      """

Current Behavior

Scenario: Snippet for undefined step with combined arguments
    Given a file named "features/undefined_steps.feature" with:
      """
      Feature:
        Scenario: combined step
          Given a "thing" with:
          \"\"\"
          thing
          \"\"\"
      """
    When I run `cucumber features/undefined_steps.feature -s`
    Then the output should contain:
      """
      Given('a {string} with:') do |string, string|
        pending # Write code here that turns the phrase above into concrete actions
      end
      """

Possible Solution

def append_block_parameter_to(array)
  parameter = format('string%<index>s', index: (array.size + 1 unless array.empty?))
  array << parameter
end

Steps to Reproduce (for bugs)

Context & Motivation

Other block parameters does not generate a "string" param, this Doc String param generates a "string"

Your Environment

  • Version used: 3.1.2
  • Operating System and version: macOS 10.14.6
  • Link to your project:
karamosky added a commit that referenced this issue Mar 20, 2020
An undefined step with a string parameter and a Doc String generates a
glue code with a syntax error.
It's better to name a Doc String a "doc_string" as param name instead of
"string"
@karamosky
Copy link
Member Author

Fixed in #1402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant