yard-nrser-cucumber 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +61 -0
  3. data/.rspec +3 -0
  4. data/.yardopts +2 -0
  5. data/Gemfile +6 -0
  6. data/History.txt +288 -0
  7. data/LICENSE.txt +22 -0
  8. data/NAME +1 -0
  9. data/README.md +198 -0
  10. data/Rakefile +27 -0
  11. data/VERSION +1 -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 +100 -0
  20. data/example/scenario_outline_multi.feature +15 -0
  21. data/example/step_definitions/example.step.rb +122 -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 +18 -0
  30. data/lib/cucumber/city_builder.rb +412 -0
  31. data/lib/docserver/default/fulldoc/html/js/cucumber.js +85 -0
  32. data/lib/docserver/default/layout/html/headers.erb +13 -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 +57 -0
  40. data/lib/templates/default/feature/html/setup.rb +51 -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 +37 -0
  46. data/lib/templates/default/featuretags/html/namespace.erb +159 -0
  47. data/lib/templates/default/featuretags/html/setup.rb +34 -0
  48. data/lib/templates/default/fulldoc/html/css/cucumber.css +226 -0
  49. data/lib/templates/default/fulldoc/html/directories.erb +27 -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 +37 -0
  52. data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +20 -0
  53. data/lib/templates/default/fulldoc/html/full_list_steps.erb +20 -0
  54. data/lib/templates/default/fulldoc/html/full_list_tags.erb +16 -0
  55. data/lib/templates/default/fulldoc/html/js/cucumber.js +333 -0
  56. data/lib/templates/default/fulldoc/html/setup.rb +208 -0
  57. data/lib/templates/default/layout/html/setup.rb +131 -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 +80 -0
  65. data/lib/templates/default/steptransformers/html/undefinedsteps.erb +26 -0
  66. data/lib/templates/default/tag/html/alpha_table.erb +33 -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-nrser-cucumber.rb +49 -0
  70. data/lib/yard/code_objects/cucumber/base.rb +24 -0
  71. data/lib/yard/code_objects/cucumber/feature.rb +16 -0
  72. data/lib/yard/code_objects/cucumber/namespace_object.rb +55 -0
  73. data/lib/yard/code_objects/cucumber/scenario.rb +25 -0
  74. data/lib/yard/code_objects/cucumber/scenario_outline.rb +68 -0
  75. data/lib/yard/code_objects/cucumber/step.rb +41 -0
  76. data/lib/yard/code_objects/cucumber/tag.rb +31 -0
  77. data/lib/yard/code_objects/step_definition.rb +4 -0
  78. data/lib/yard/code_objects/step_transform.rb +4 -0
  79. data/lib/yard/code_objects/step_transformer.rb +94 -0
  80. data/lib/yard/handlers/constant_transform_handler.rb +98 -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 +50 -0
  87. data/lib/yard/nrser/cucumber/version.rb +103 -0
  88. data/lib/yard/parser/cucumber/feature.rb +72 -0
  89. data/lib/yard/server/adapter.rb +43 -0
  90. data/lib/yard/server/commands/list_command.rb +31 -0
  91. data/lib/yard/server/router.rb +32 -0
  92. data/lib/yard/templates/helpers/base_helper.rb +26 -0
  93. data/lib/yard/templates/helpers/html_helper.rb +153 -0
  94. data/yard-nrser-cucumber.gemspec +75 -0
  95. metadata +220 -0
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require 'rake'
2
+ require "bundler/gem_tasks"
3
+
4
+ # Stuff that came from `yard-cucumber`...
5
+
6
+ # task :default => :gendoc
7
+
8
+ # desc "Clean out any existing documentation"
9
+ # task :clean do
10
+ # `rm -rf doc`
11
+ # `rm -rf .yardoc`
12
+ # end
13
+
14
+ # desc "Generate documentation from the example data"
15
+ # task :gendoc => :clean do
16
+ # puts `yardoc -e ./lib/yard-cucumber.rb 'example/**/*' --debug`
17
+ # end
18
+
19
+ # desc "Run the YARD Server"
20
+ # task :server => :gendoc do
21
+ # puts `yard server -e ./lib/yard-cucumber.rb`
22
+ # end
23
+
24
+ # desc "Create the yard-cucumber gem"
25
+ # task :gem do
26
+ # puts `gem build yard-cucumber.gemspec`
27
+ # end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/example/README.md ADDED
@@ -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,100 @@
1
+ @scenario_outlines @bvt @duplicate
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
+ @tagged_examples
13
+ Examples:
14
+ | Customer | Product |
15
+ | Customer A | Product A |
16
+ | Customer A | Product B |
17
+ | Customer A | Product C |
18
+
19
+ @second
20
+ Scenario Outline: Step contains a text block
21
+ Given the following text:
22
+ """
23
+ The <noun> jumped over the <place>
24
+ """
25
+ When I click on an example row
26
+ Then I expect <noun> to be replaced by the example noun
27
+ And I expect <place> to be replaced by the example place
28
+
29
+ Examples:
30
+ | noun | place |
31
+ | cow | moon |
32
+ | horse | spoon |
33
+
34
+ @third
35
+ Scenario Outline: Step contains a table
36
+ Given the following table:
37
+ | name | price | quantity |
38
+ | <name> | <price> | 100000 |
39
+ When I click on an example row
40
+ Then I expect <name> to be replaced by the example name
41
+ And I expect <price> to be replaced by the example price
42
+
43
+ Examples:
44
+ | name | price |
45
+ | toy | $99 |
46
+ | game | $49 |
47
+
48
+ @fourth
49
+ Scenario Outline: Step contains a table; table header uses an example
50
+ Given the following table:
51
+ | name | <denomination> | quantity |
52
+ | <name> | <price> | 100000 |
53
+ When I click on an example row
54
+ Then I expect <name> to be replaced by the example name
55
+ And I expect <price> to be replaced by the example price
56
+ And I expect <denomination> to be replaced by the example denomination
57
+
58
+ Examples:
59
+ | name | price | denomination |
60
+ | toy | 99 | cost in euros |
61
+ | game | 49 | cost in dollars |
62
+
63
+ # This is an example of a scenario outline in development.
64
+ # The example table has not been defined yet
65
+ @fifth
66
+ Scenario Outline: Example Table Missing
67
+ When I click on an example row
68
+ Then I expect <name> to be replaced by the example name
69
+ And I expect <price> to be replaced by the example price
70
+ And I expect <denomination> to be replaced by the example denomination
71
+
72
+
73
+ # This is an example of a scenario outline in development.
74
+ # The examples table has been defined, but is missing data.
75
+ @sixth
76
+ Scenario Outline: Empty Example Table
77
+ When I click on an example row
78
+ Then I expect <name> to be replaced by the example name
79
+ And I expect <price> to be replaced by the example price
80
+ And I expect <denomination> to be replaced by the example denomination
81
+
82
+ Examples:
83
+ | name | price | denomination |
84
+
85
+ @seventh @duplicate
86
+ Scenario Outline: Multiple Example Table
87
+ Given that <Customer> is a valid customer
88
+ And that the product, named '<Product>', is a valid product
89
+ When the customer has purchased the product
90
+ Then I expect the customer to be a member of the '<Product>' group
91
+
92
+ @groupA @duplicate
93
+ Examples: Example group A
94
+ | Customer | Product |
95
+ | Customer A | Product A |
96
+
97
+ @groupB
98
+ Examples: Example group B
99
+ | Customer | Product |
100
+ | 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,122 @@
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
+ #
30
+ # Assign a trnasform to a variable to be interpolated later in a step definition
31
+ #
32
+ SUBSTITUTED_FILE = Transform(/^file '([^']*)'$/) do |filepath|
33
+ "Contents loaded from file"
34
+ end
35
+
36
+ Given /^that (#{CUSTOMER}) is a valid customer$/ do |customer|
37
+ pending "Customer #{customer} validation"
38
+ end
39
+
40
+ #
41
+ # This comment will likely blow {things up}!
42
+ #
43
+ When /^a customer logs in as username '([^']+)' with password '([^']+)'$/ do |username,password|
44
+ Given "that the customer is a valid customer"
45
+ pending "Customer logs in with #{username} and #{password}"
46
+ end
47
+
48
+ Then /^I expect them to have logged in (successfully|miserably)$/ do |success|
49
+ pending "Validation that the customer has logged in #{success}"
50
+ end
51
+
52
+ When /^the customer logs out$/ do
53
+ pending
54
+ end
55
+
56
+ Then /^I expect the customer to be shown the logout page$/ do
57
+ pending
58
+ end
59
+
60
+ And /^this (third) defined step definition$/ do |number|
61
+ pending
62
+ end
63
+
64
+ And /^the customer has the following details:$/ do |table|
65
+ pending "Table of data #{table.hashes}"
66
+ end
67
+
68
+ And /^edits their the (biography) to state:$/ do |section,text|
69
+ pending "text_field not present for #{section} #{bio} for this release"
70
+ end
71
+
72
+ Then /I expect (#{CUSTOMER}) to be a member of the '([^']+)' group/ do |customer,product|
73
+ pending "Customer #{customer} with product #{product}"
74
+ end
75
+
76
+ #
77
+ # Complicated step definition with optional parameters
78
+ #
79
+ 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|
80
+ pending "#{state} #{size} #{name} #{start_date} #{end_date} #{user_range} #{description} #{nickname}"
81
+ end
82
+
83
+
84
+ #
85
+ # The highlighting replacement uses a span which had trouble when blindly using
86
+ # a gsub replacement.
87
+ #
88
+ Given /(a|\d+) ducks? that ha(?:s|ve) (a|\d+) bills?/ do |duck_count,bills_count|
89
+ pending
90
+ end
91
+
92
+ Then /I expect the (duck|bird) to (\w+)/ do |animal,verb|
93
+ pending
94
+ end
95
+
96
+ #
97
+ # This double-quoted step definition caused some problems when being rendered
98
+ #
99
+ When /^searching the log for the exact match of the message "([^"]+)"$/ do |message|
100
+ pending message
101
+ end
102
+
103
+ #
104
+ #
105
+ #
106
+ When /^the step definition has HTML escaped characters like: "([^"]+)"$/ do |characters|
107
+ pending characters
108
+ end
109
+
110
+ #
111
+ # Step using interpolated transform to replace file reference with contents of file
112
+ #
113
+ Then /^the (#{SUBSTITUTED_FILE}) will be replaced with the file contents$/ do |content|
114
+ pending "File contained #{content}"
115
+ end
116
+
117
+ #
118
+ # Some details about the helper method that might be picked up in the documentation.
119
+ #
120
+ def a_helper_method
121
+ puts "performs some operation"
122
+ 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