yard-cucumber2 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +3 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.lock +37 -0
  8. data/History.txt +274 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +188 -0
  11. data/Rakefile +25 -0
  12. data/example/README.md +8 -0
  13. data/example/child_feature/README.md +21 -0
  14. data/example/child_feature/child.feature +11 -0
  15. data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
  16. data/example/empty.feature +2 -0
  17. data/example/french.feature +18 -0
  18. data/example/scenario.feature +63 -0
  19. data/example/scenario_outline.feature +94 -0
  20. data/example/scenario_outline_multi.feature +15 -0
  21. data/example/step_definitions/example.step.rb +109 -0
  22. data/example/step_definitions/first.step.rb +21 -0
  23. data/example/step_definitions/french_steps.rb +32 -0
  24. data/example/step_definitions/struct.rb +11 -0
  25. data/example/step_definitions/support/env.rb +7 -0
  26. data/example/step_definitions/support/env_support.rb +12 -0
  27. data/example/step_definitions/support/support.rb +6 -0
  28. data/example/tags.feature +18 -0
  29. data/example/transform.feature +13 -0
  30. data/lib/cucumber/city_builder.rb +331 -0
  31. data/lib/docserver/default/fulldoc/html/js/cucumber.js +85 -0
  32. data/lib/docserver/default/layout/html/headers.erb +14 -0
  33. data/lib/docserver/doc_server/full_list/html/full_list.erb +39 -0
  34. data/lib/docserver/doc_server/full_list/html/setup.rb +18 -0
  35. data/lib/templates/default/feature/html/feature.erb +39 -0
  36. data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
  37. data/lib/templates/default/feature/html/outline.erb +56 -0
  38. data/lib/templates/default/feature/html/pystring.erb +3 -0
  39. data/lib/templates/default/feature/html/scenario.erb +55 -0
  40. data/lib/templates/default/feature/html/setup.rb +55 -0
  41. data/lib/templates/default/feature/html/steps.erb +39 -0
  42. data/lib/templates/default/feature/html/table.erb +20 -0
  43. data/lib/templates/default/featuredirectory/html/alpha_table.erb +30 -0
  44. data/lib/templates/default/featuredirectory/html/directory.erb +32 -0
  45. data/lib/templates/default/featuredirectory/html/setup.rb +41 -0
  46. data/lib/templates/default/featuretags/html/namespace.erb +131 -0
  47. data/lib/templates/default/featuretags/html/setup.rb +34 -0
  48. data/lib/templates/default/fulldoc/html/css/cucumber.css +227 -0
  49. data/lib/templates/default/fulldoc/html/directories.erb +53 -0
  50. data/lib/templates/default/fulldoc/html/full_list_featuredirectories.erb +11 -0
  51. data/lib/templates/default/fulldoc/html/full_list_features.erb +29 -0
  52. data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +16 -0
  53. data/lib/templates/default/fulldoc/html/full_list_steps.erb +17 -0
  54. data/lib/templates/default/fulldoc/html/full_list_tags.erb +12 -0
  55. data/lib/templates/default/fulldoc/html/js/cucumber.js +305 -0
  56. data/lib/templates/default/fulldoc/html/setup.rb +175 -0
  57. data/lib/templates/default/layout/html/setup.rb +56 -0
  58. data/lib/templates/default/requirements/html/alpha_table.erb +26 -0
  59. data/lib/templates/default/requirements/html/requirements.erb +50 -0
  60. data/lib/templates/default/requirements/html/setup.rb +51 -0
  61. data/lib/templates/default/steptransformers/html/header.erb +12 -0
  62. data/lib/templates/default/steptransformers/html/index.erb +10 -0
  63. data/lib/templates/default/steptransformers/html/setup.rb +94 -0
  64. data/lib/templates/default/steptransformers/html/transformers.erb +79 -0
  65. data/lib/templates/default/steptransformers/html/undefinedsteps.erb +26 -0
  66. data/lib/templates/default/tag/html/alpha_table.erb +32 -0
  67. data/lib/templates/default/tag/html/setup.rb +27 -0
  68. data/lib/templates/default/tag/html/tag.erb +35 -0
  69. data/lib/yard-cucumber.rb +47 -0
  70. data/lib/yard-cucumber/version.rb +3 -0
  71. data/lib/yard/code_objects/cucumber/base.rb +32 -0
  72. data/lib/yard/code_objects/cucumber/feature.rb +18 -0
  73. data/lib/yard/code_objects/cucumber/namespace_object.rb +49 -0
  74. data/lib/yard/code_objects/cucumber/scenario.rb +26 -0
  75. data/lib/yard/code_objects/cucumber/scenario_outline.rb +75 -0
  76. data/lib/yard/code_objects/cucumber/step.rb +38 -0
  77. data/lib/yard/code_objects/cucumber/tag.rb +27 -0
  78. data/lib/yard/code_objects/step_definition.rb +7 -0
  79. data/lib/yard/code_objects/step_transform.rb +7 -0
  80. data/lib/yard/code_objects/step_transformer.rb +97 -0
  81. data/lib/yard/handlers/cucumber/base.rb +21 -0
  82. data/lib/yard/handlers/cucumber/feature_handler.rb +131 -0
  83. data/lib/yard/handlers/legacy/step_definition_handler.rb +45 -0
  84. data/lib/yard/handlers/legacy/step_transform_handler.rb +24 -0
  85. data/lib/yard/handlers/step_definition_handler.rb +86 -0
  86. data/lib/yard/handlers/step_transform_handler.rb +31 -0
  87. data/lib/yard/parser/cucumber/feature.rb +73 -0
  88. data/lib/yard/server/adapter.rb +43 -0
  89. data/lib/yard/server/commands/list_command.rb +31 -0
  90. data/lib/yard/server/router.rb +32 -0
  91. data/lib/yard/templates/helpers/base_helper.rb +26 -0
  92. data/yard-cucumber.gemspec +65 -0
  93. metadata +199 -0
@@ -0,0 +1,25 @@
1
+ require 'rake'
2
+
3
+ task :default => :gendoc
4
+
5
+ desc "Clean out any existing documentation"
6
+ task :clean do
7
+ `rm -rf doc`
8
+ `rm -rf .yardoc`
9
+ end
10
+
11
+ desc "Generate documentation from the example data"
12
+ task :gendoc => :clean do
13
+ puts `yardoc -e ./lib/yard-cucumber.rb 'example/**/*' --debug`
14
+ end
15
+
16
+ desc "Run the YARD Server"
17
+ task :server => :gendoc do
18
+ puts `yard server -e ./lib/yard-cucumber.rb`
19
+ end
20
+
21
+ desc "Create the yard-cucumber gem"
22
+ task :gem do
23
+ puts `gem build city.gemspec`
24
+ end
25
+
@@ -0,0 +1,8 @@
1
+ This collection of features are really just to test some of the varied cases
2
+ that CITY may come in contact with while parsing a series of features. All
3
+ of the features, tags, and directories displayed here are contained in this
4
+ directory and all subdirectories.
5
+
6
+ * First, the features which are broken down alphabetically and displayed
7
+ * Second, the tags, used by all the features and scenarios
8
+ * Third, the subdirectories, contained in this directory and in the subdirectories.
@@ -0,0 +1,21 @@
1
+ Child Features
2
+ ==============
3
+
4
+ Synopsis
5
+ --------
6
+
7
+ This collection of features are contained in this folder. The description README
8
+ allows a user to place a description for entire directory of the features and appears
9
+ in the output to assist with understanding about the collection of features.
10
+
11
+ Resources
12
+ ---------
13
+
14
+ Links to particular resources like the links to the stories, tasks, or other areas
15
+ can also be represented.
16
+
17
+ The implemented example has been deployed at [http://recursivegames.com/cukes/](http://recursivegames.com/cukes/).
18
+
19
+ **1. An Item** [example](http://recursivegames.com/cukes/requirements/)
20
+
21
+
@@ -0,0 +1,11 @@
1
+ @scenarios
2
+ Feature: Child Feature
3
+ As a reader of the documentation I expect that scenario are documented correctly
4
+
5
+ Background:
6
+ Given this background step
7
+
8
+ Scenario: Child Scenario
9
+ Given this first step
10
+ When this second step
11
+ Then this third step
@@ -0,0 +1,12 @@
1
+ @scenarios
2
+ Feature: Grandchild Feature
3
+ As a reader of the documentation I expect that scenario are documented correctly
4
+
5
+ Background:
6
+ Given this background step
7
+
8
+ @first
9
+ Scenario: Grandchild Scenario
10
+ Given this first step
11
+ When this second step
12
+ Then this third step
@@ -0,0 +1,2 @@
1
+ # This is a feature that has not been written
2
+ # However, I don't want parser to fail when reaching this file
@@ -0,0 +1,18 @@
1
+ # language: fr
2
+ Fonctionnalité: Addition
3
+ Afin de gagner du temps lors du calcul de la facture
4
+ En tant que commerçant
5
+ Je souhaite pouvoir faire une addition
6
+
7
+ Plan du Scénario: Addition de deux nombres
8
+ Soit une calculatrice
9
+ Et que j'entre <a> pour le premier nombre
10
+ Et que je tape sur la touche "+"
11
+ Et que j'entre <b> pour le second nombre
12
+ Lorsque je tape sur la touche "="
13
+ Alors le résultat affiché doit être <somme>
14
+
15
+ Exemples:
16
+ | a | b | somme |
17
+ | 2 | 2 | 4 |
18
+ | 2 | 3 | 5 |
@@ -0,0 +1,63 @@
1
+ # Comments that appear before the feature are associated with the feature
2
+ @scenarios
3
+ Feature: Displaying Scenarios
4
+ As a reader of the documentation I expect that scenario are documented correctly
5
+
6
+ # Comments after the feature description belong to the background or first scenario
7
+ Background:
8
+ Given this background step
9
+
10
+ @first @bvt
11
+ Scenario: No Step Scenario
12
+
13
+ @second @bvt
14
+ Scenario: Scenario With Steps
15
+ Given this first step
16
+ When this second step
17
+ Then this third step
18
+
19
+ @third @optional_parameters
20
+ Scenario: Optional Parameter Step Definition
21
+ # This step definition has some optional parameters
22
+ Given a project
23
+ And an inactive project
24
+ And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
25
+
26
+ @fourth @highlight
27
+ Scenario: Matched Term Highlighting
28
+ Given a duck that has a bill
29
+ Then I expect the duck to quack
30
+
31
+ @fifth @table
32
+ Scenario: Scenario With Table
33
+ Given the following table:
34
+ | column 1 | column 2 | column 3 |
35
+ | value 1 | value 2 | value 3 |
36
+
37
+ @sixth @text
38
+ Scenario: Scenario With Text
39
+ Given the following text:
40
+ """
41
+ Oh what a bother!
42
+ That this text has to take up two lines
43
+ This line should be indented 2 spaces
44
+ This line should be indented 4 spaces
45
+ """
46
+
47
+ # Comments before the scenario
48
+ @seventh @comments
49
+ Scenario: Scenario with comments and a description
50
+ There once was a need for information to be displayed alongside all the
51
+ entities that I hoped to test
52
+ # First Comment
53
+ Given this first step
54
+ # Second Comment that
55
+ # spans a few lines
56
+ And this second step
57
+ # Third Comment
58
+ And this third step
59
+ # Comments after the last step, where do they go?
60
+
61
+ Scenario: Step ending with a match with double-quotes
62
+ When searching the log for the exact match of the message "Entering application."
63
+ When the step definition has HTML escaped characters like: "<>&"
@@ -0,0 +1,94 @@
1
+ @scenario_outlines @bvt
2
+ Feature: Displaying Scenario Outlines
3
+ As a reader of the documentation I expect that scenario outlines are documented correctly
4
+
5
+ @first
6
+ Scenario Outline: Three Examples
7
+ Given that <Customer> is a valid customer
8
+ And that the product, named '<Product>', is a valid product
9
+ When the customer has purchased the product
10
+ Then I expect the customer to be a member of the '<Product>' group
11
+
12
+ Examples:
13
+ | Customer | Product |
14
+ | Customer A | Product A |
15
+ | Customer A | Product B |
16
+ | Customer A | Product C |
17
+
18
+ @second
19
+ Scenario Outline: Step contains a text block
20
+ Given the following text:
21
+ """
22
+ The <noun> jumped over the <place>
23
+ """
24
+ When I click on an example row
25
+ Then I expect <noun> to be replaced by the example noun
26
+ And I expect <place> to be replaced by the example place
27
+
28
+ Examples:
29
+ | noun | place |
30
+ | cow | moon |
31
+ | horse | spoon |
32
+
33
+ @third
34
+ Scenario Outline: Step contains a table
35
+ Given the following table:
36
+ | name | price | quantity |
37
+ | <name> | <price> | 100000 |
38
+ When I click on an example row
39
+ Then I expect <name> to be replaced by the example name
40
+ And I expect <price> to be replaced by the example price
41
+
42
+ Examples:
43
+ | name | price |
44
+ | toy | $99 |
45
+ | game | $49 |
46
+
47
+ @fourth
48
+ Scenario Outline: Step contains a table; table header uses an example
49
+ Given the following table:
50
+ | name | <denomination> | quantity |
51
+ | <name> | <price> | 100000 |
52
+ When I click on an example row
53
+ Then I expect <name> to be replaced by the example name
54
+ And I expect <price> to be replaced by the example price
55
+ And I expect <denomination> to be replaced by the example denomination
56
+
57
+ Examples:
58
+ | name | price | denomination |
59
+ | toy | 99 | cost in euros |
60
+ | game | 49 | cost in dollars |
61
+
62
+ # This is an example of a scenario outline in development.
63
+ # The example table has not been defined yet
64
+ Scenario Outline: Example Table Missing
65
+ When I click on an example row
66
+ Then I expect <name> to be replaced by the example name
67
+ And I expect <price> to be replaced by the example price
68
+ And I expect <denomination> to be replaced by the example denomination
69
+
70
+
71
+ # This is an example of a scenario outline in development.
72
+ # The examples table has been defined, but is missing data.
73
+ Scenario Outline: Empty Example Table
74
+ When I click on an example row
75
+ Then I expect <name> to be replaced by the example name
76
+ And I expect <price> to be replaced by the example price
77
+ And I expect <denomination> to be replaced by the example denomination
78
+
79
+ Examples:
80
+ | name | price | denomination |
81
+
82
+ Scenario Outline: Multiple Example Table
83
+ Given that <Customer> is a valid customer
84
+ And that the product, named '<Product>', is a valid product
85
+ When the customer has purchased the product
86
+ Then I expect the customer to be a member of the '<Product>' group
87
+
88
+ Examples: Example group A
89
+ | Customer | Product |
90
+ | Customer A | Product A |
91
+
92
+ Examples: Example group B
93
+ | Customer | Product |
94
+ | Customer B | Product A |
@@ -0,0 +1,15 @@
1
+ Feature: My Feature
2
+
3
+ Scenario Outline: Multiple Example Table
4
+ Given that <Customer> is a valid customer
5
+ And that the product, named '<Product>', is a valid product
6
+ When the customer has purchased the product
7
+ Then I expect the customer to be a member of the '<Product>' group
8
+
9
+ Examples: Example group A
10
+ | Customer | Product |
11
+ | Customer A | Product A |
12
+
13
+ Examples: Example group B
14
+ | Customer | Product |
15
+ | Customer B | Product A |
@@ -0,0 +1,109 @@
1
+
2
+ Transform /^#{CUSTOMER}$/ do |customer|
3
+ "a transformed customer"
4
+ end
5
+
6
+ Transform /^an? customer$/ do |customer|
7
+ "a transformed customer"
8
+ end
9
+
10
+ Transform /^the customer$/ do |customer|
11
+ "the transformed customer"
12
+ end
13
+
14
+ Transform /^(#{ORDER}) customer$/ do |order|
15
+ "#{order} customer"
16
+ end
17
+
18
+ Transform /^#{TEDDY_BEAR}$/ do |teddy|
19
+ "the tranformed teddy bear"
20
+ end
21
+
22
+ #
23
+ # This is a complicated Transform with a comment
24
+ #
25
+ Transform /^((?:\d{1,2}[\/-]){2}(?:\d\d){1,2})?\s*(\w{3})?\s*(\d{1,2}:\d{2}\s*(?:AM|PM)?)$/ do |date,day,time|
26
+ "#{date} #{day} #{time}"
27
+ end
28
+
29
+ Given /^that (#{CUSTOMER}) is a valid customer$/ do |customer|
30
+ pending "Customer #{customer} validation"
31
+ end
32
+
33
+ #
34
+ # This comment will likely blow {things up}!
35
+ #
36
+ When /^a customer logs in as username '([^']+)' with password '([^']+)'$/ do |username,password|
37
+ Given "that the customer is a valid customer"
38
+ pending "Customer logs in with #{username} and #{password}"
39
+ end
40
+
41
+ Then /^I expect them to have logged in (successfully|miserably)$/ do |success|
42
+ pending "Validation that the customer has logged in #{success}"
43
+ end
44
+
45
+ When /^the customer logs out$/ do
46
+ pending
47
+ end
48
+
49
+ Then /^I expect the customer to be shown the logout page$/ do
50
+ pending
51
+ end
52
+
53
+ And /^this (third) defined step definition$/ do |number|
54
+ pending
55
+ end
56
+
57
+ And /^the customer has the following details:$/ do |table|
58
+ pending "Table of data #{table.hashes}"
59
+ end
60
+
61
+ And /^edits their the (biography) to state:$/ do |section,text|
62
+ pending "text_field not present for #{section} #{bio} for this release"
63
+ end
64
+
65
+ Then /I expect (#{CUSTOMER}) to be a member of the '([^']+)' group/ do |customer,product|
66
+ pending "Customer #{customer} with product #{product}"
67
+ end
68
+
69
+ #
70
+ # Complicated step definition with optional parameters
71
+ #
72
+ Given /^(?:I create )?an? (?:(active|deactive|inactive|simulated)d?)? ?project(?:[\s,]*(?:with)? ?(?:an?|the)? (?:(?:the size? (?:at|of)? ?(\d+)|named? (?:of )?'([^']+)'|start date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|end date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|user range (?:of )?(\d+-\d+)|description (?:of )?'([^']+)'|nicknamed? (?:of )?'([^']+)')[,\s]*)* ?)?$/ do |state,size,name,start_date,end_date,user_range,description,nickname|
73
+ pending "#{state} #{size} #{name} #{start_date} #{end_date} #{user_range} #{description} #{nickname}"
74
+ end
75
+
76
+
77
+ #
78
+ # The highlighting replacement uses a span which had trouble when blindly using
79
+ # a gsub replacement.
80
+ #
81
+ Given /(a|\d+) ducks? that ha(?:s|ve) (a|\d+) bills?/ do |duck_count,bills_count|
82
+ pending
83
+ end
84
+
85
+ Then /I expect the (duck|bird) to (\w+)/ do |animal,verb|
86
+ pending
87
+ end
88
+
89
+ #
90
+ # This double-quoted step definition caused some problems when being rendered
91
+ #
92
+ When /^searching the log for the exact match of the message "([^"]+)"$/ do |message|
93
+ pending message
94
+ end
95
+
96
+ #
97
+ #
98
+ #
99
+ When /^the step definition has HTML escaped characters like: "([^"]+)"$/ do |characters|
100
+ pending characters
101
+ end
102
+
103
+
104
+ #
105
+ # Some details about the helper method that might be picked up in the documentation.
106
+ #
107
+ def a_helper_method
108
+ puts "performs some operation"
109
+ end
@@ -0,0 +1,21 @@
1
+ Transform /^#{ORDER}$/ do |order|
2
+ order
3
+ end
4
+
5
+ Transform /^background$/ do |background|
6
+ "background"
7
+ end
8
+
9
+ #
10
+ # This step transform converts "scenario" to "scenario"
11
+ #
12
+ Transform /^scenario$/ do |scenario|
13
+ "scenario"
14
+ end
15
+
16
+ #
17
+ # This step definition is all about steps
18
+ #
19
+ Given /^this (scenario|background|#{ORDER}) step$/ do |step|
20
+ puts "step #{order}"
21
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+ Soit /^une calculatrice$/ do
3
+ @calc = Calculatrice.new
4
+ end
5
+
6
+ Etantdonné /^qu'on tape (.*)$/ do |n|
7
+ @calc.push n.to_i
8
+ end
9
+
10
+ Etantdonné /^que j'entre (\d+) pour le (.*) nombre/ do |n, x|
11
+ @calc.push n.to_i
12
+ end
13
+
14
+ Lorsque /^je tape sur la touche "="$/ do
15
+ @expected_result = @calc.additionner
16
+ end
17
+
18
+ Lorsqu /on tape additionner/ do
19
+ @expected_result = @calc.additionner
20
+ end
21
+
22
+ Alors /le résultat affiché doit être (\d*)/ do |result|
23
+ result.to_i.should == @expected_result
24
+ end
25
+
26
+ Alors /le résultat doit être (\d*)/ do |result|
27
+ result.to_i.should == @expected_result
28
+ end
29
+
30
+ Soit /^que je tape sur la touche "\+"$/ do
31
+ # noop
32
+ end