You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

doc_strings.feature 1.8 kB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. Feature: Doc strings
  2. If you need to specify information in a scenario that won't fit on a single line,
  3. you can use a DocString.
  4. A DocString follows a step, and starts and ends with three double quotes, like this:
  5. ```gherkin
  6. When I ask to reset my password
  7. Then I should receive an email with:
  8. """
  9. Dear bozo,
  10. Please click this link to reset your password
  11. """
  12. ```
  13. It's possible to annotate the DocString with the type of content it contains. This is used by
  14. formatting tools like http://relishapp.com which will render the contents of the DocString
  15. appropriately. You specify the content type after the triple quote, like this:
  16. ```gherkin
  17. Given there is some Ruby code:
  18. """ruby
  19. puts "hello world"
  20. """
  21. ```
  22. You can read the content type from the argument passed into your step definition, as shown
  23. in the example below.
  24. Scenario: Plain text Docstring
  25. Given a scenario with a step that looks like this:
  26. """gherkin
  27. Given I have a lot to say:
  28. \"\"\"
  29. One
  30. Two
  31. Three
  32. \"\"\"
  33. """
  34. And a step definition that looks like this:
  35. """ruby
  36. Given /say/ do |text|
  37. log text
  38. end
  39. """
  40. When I run the feature with the progress formatter
  41. Then the output should contain:
  42. """
  43. One
  44. Two
  45. Three
  46. """
  47. Scenario: DocString passed as String
  48. Given a scenario with a step that looks like this:
  49. """gherkin
  50. Given I have some code for you:
  51. \"\"\"
  52. hello
  53. \"\"\"
  54. """
  55. And a step definition that looks like this:
  56. """ruby
  57. Given /code/ do |text|
  58. log text.class.to_s
  59. end
  60. """
  61. When I run the feature with the progress formatter
  62. Then the output should contain:
  63. """
  64. String
  65. """

No Description

Contributors (1)