cucumber 0.9.4 → 0.10.0

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 (107) hide show
  1. data/Gemfile +1 -1
  2. data/History.txt +16 -0
  3. data/bin/cucumber +7 -1
  4. data/cucumber.gemspec +5 -4
  5. data/cucumber.yml +1 -1
  6. data/examples/sinatra/features/support/env.rb +1 -4
  7. data/features/background.feature +284 -95
  8. data/features/custom_formatter.feature +3 -73
  9. data/features/execute_with_tag_filter.feature +63 -0
  10. data/features/{negative_tagged_hooks.feature → hooks.feature} +5 -6
  11. data/features/json_formatter.feature +161 -245
  12. data/features/stats_formatters.feature +70 -0
  13. data/features/step_definitions/cucumber_steps.rb +5 -163
  14. data/features/support/env.rb +23 -149
  15. data/features/{tag_logic.feature → tagged_hooks.feature} +11 -52
  16. data/gem_tasks/{features.rake → cucumber.rake} +6 -1
  17. data/{features → legacy_features}/announce.feature +0 -0
  18. data/{features → legacy_features}/api/list_step_defs_as_json.feature +0 -0
  19. data/{features → legacy_features}/api/run_cli_main_with_existing_runtime.feature +0 -0
  20. data/{features → legacy_features}/around_hooks.feature +0 -0
  21. data/{features → legacy_features}/bug_371.feature +0 -0
  22. data/{features → legacy_features}/bug_464.feature +0 -0
  23. data/{features → legacy_features}/bug_475.feature +0 -0
  24. data/{features → legacy_features}/bug_585_tab_indentation.feature +0 -0
  25. data/{features → legacy_features}/bug_600.feature +0 -0
  26. data/{features → legacy_features}/call_steps_from_stepdefs.feature +0 -0
  27. data/{features → legacy_features}/cucumber_cli.feature +9 -9
  28. data/{features → legacy_features}/cucumber_cli_outlines.feature +0 -0
  29. data/{features → legacy_features}/default_snippets.feature +0 -0
  30. data/{features → legacy_features}/diffing.feature +0 -0
  31. data/{features → legacy_features}/drb_server_integration.feature +0 -0
  32. data/{features → legacy_features}/exception_in_after_block.feature +0 -0
  33. data/{features → legacy_features}/exception_in_after_step_block.feature +0 -0
  34. data/{features → legacy_features}/exception_in_before_block.feature +0 -0
  35. data/{features → legacy_features}/exclude_files.feature +0 -0
  36. data/{features → legacy_features}/expand.feature +0 -0
  37. data/{features → legacy_features}/html_formatter.feature +0 -0
  38. data/{features → legacy_features}/html_formatter/a.html +0 -0
  39. data/{features → legacy_features}/junit_formatter.feature +0 -0
  40. data/{features → legacy_features}/language_from_header.feature +0 -0
  41. data/{features → legacy_features}/language_help.feature +0 -0
  42. data/{features → legacy_features}/listener_debugger_formatter.feature +0 -0
  43. data/legacy_features/multiline_names.feature +44 -0
  44. data/{features → legacy_features}/post_configuration_hook.feature +0 -0
  45. data/{features → legacy_features}/profiles.feature +0 -0
  46. data/{features → legacy_features}/rake_task.feature +0 -0
  47. data/{features → legacy_features}/report_called_undefined_steps.feature +0 -0
  48. data/{features → legacy_features}/rerun_formatter.feature +0 -0
  49. data/{features → legacy_features}/simplest.feature +0 -0
  50. data/{features → legacy_features}/snippet.feature +0 -0
  51. data/{features → legacy_features}/snippets_when_using_star_keyword.feature +0 -0
  52. data/legacy_features/step_definitions/cucumber_steps.rb +168 -0
  53. data/{features → legacy_features}/step_definitions/extra_steps.rb +0 -0
  54. data/{features → legacy_features}/step_definitions/simplest_steps.rb +0 -0
  55. data/{features → legacy_features}/step_definitions/wire_steps.rb +1 -0
  56. data/legacy_features/support/env.rb +157 -0
  57. data/{features → legacy_features}/support/env.rb.simplest +0 -0
  58. data/{features → legacy_features}/support/fake_wire_server.rb +0 -0
  59. data/{features → legacy_features}/table_diffing.feature +0 -0
  60. data/{features → legacy_features}/table_mapping.feature +0 -0
  61. data/{features → legacy_features}/transform.feature +0 -0
  62. data/{features → legacy_features}/unicode_table.feature +0 -0
  63. data/{features → legacy_features}/wire_protocol.feature +1 -1
  64. data/{features → legacy_features}/wire_protocol_table_diffing.feature +0 -0
  65. data/{features → legacy_features}/wire_protocol_tags.feature +0 -0
  66. data/{features → legacy_features}/wire_protocol_timeouts.feature +0 -0
  67. data/{features → legacy_features}/work_in_progress.feature +0 -0
  68. data/lib/cucumber/ast/examples.rb +5 -0
  69. data/lib/cucumber/ast/feature.rb +5 -0
  70. data/lib/cucumber/ast/feature_element.rb +5 -0
  71. data/lib/cucumber/ast/scenario_outline.rb +9 -4
  72. data/lib/cucumber/ast/step.rb +5 -0
  73. data/lib/cucumber/ast/step_invocation.rb +4 -0
  74. data/lib/cucumber/ast/table.rb +3 -3
  75. data/lib/cucumber/ast/tree_walker.rb +1 -39
  76. data/lib/cucumber/cli/main.rb +1 -6
  77. data/lib/cucumber/cli/options.rb +1 -2
  78. data/lib/cucumber/formatter/ansicolor.rb +2 -4
  79. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +84 -0
  80. data/lib/cucumber/formatter/gpretty.rb +24 -0
  81. data/lib/cucumber/formatter/html.rb +1 -1
  82. data/lib/cucumber/formatter/io.rb +2 -4
  83. data/lib/cucumber/formatter/json.rb +15 -152
  84. data/lib/cucumber/formatter/json_pretty.rb +5 -6
  85. data/lib/cucumber/formatter/unicode.rb +41 -20
  86. data/lib/cucumber/parser/gherkin_builder.rb +7 -1
  87. data/lib/cucumber/platform.rb +1 -1
  88. data/lib/cucumber/step_match.rb +5 -1
  89. data/spec/cucumber/ast/scenario_outline_spec.rb +11 -8
  90. data/spec/cucumber/ast/table_spec.rb +6 -1
  91. data/spec/cucumber/cli/main_spec.rb +4 -1
  92. metadata +105 -132
  93. data/features/multiline_names.feature +0 -44
  94. data/features/usage_and_stepdefs_formatter.feature +0 -169
  95. data/fixtures/json/features/pystring.feature +0 -8
  96. data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +0 -12
  97. data/fixtures/self_test/features/background/background_with_name.feature +0 -7
  98. data/fixtures/self_test/features/background/failing_background.feature +0 -12
  99. data/fixtures/self_test/features/background/failing_background_after_success.feature +0 -11
  100. data/fixtures/self_test/features/background/multiline_args_background.feature +0 -32
  101. data/fixtures/self_test/features/background/passing_background.feature +0 -10
  102. data/fixtures/self_test/features/background/pending_background.feature +0 -10
  103. data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +0 -16
  104. data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +0 -16
  105. data/lib/cucumber/formatter/color_io.rb +0 -23
  106. data/lib/cucumber/formatter/tag_cloud.rb +0 -35
  107. data/spec/cucumber/formatter/color_io_spec.rb +0 -29
@@ -1,44 +0,0 @@
1
- Feature: Multiline description names
2
- In order to accurately document feature elements
3
- As a cucumberist
4
- I want to have multiline names
5
-
6
- Scenario: multiline scenario
7
- When I run cucumber features/multiline_name.feature --no-snippets
8
- Then STDERR should be empty
9
- Then it should pass with
10
- """
11
- Feature: multiline
12
-
13
- Background: I'm a multiline name # features/multiline_name.feature:3
14
- which goes on and on and on for three lines
15
- yawn
16
- Given passing without a table # features/step_definitions/sample_steps.rb:12
17
-
18
- Scenario: I'm a multiline name # features/multiline_name.feature:8
19
- which goes on and on and on for three lines
20
- yawn
21
- Given passing without a table # features/step_definitions/sample_steps.rb:12
22
-
23
- Scenario Outline: I'm a multiline name # features/multiline_name.feature:13
24
- which goes on and on and on for three lines
25
- yawn
26
- Given <state> without a table # features/step_definitions/sample_steps.rb:12
27
-
28
- Examples:
29
- | state |
30
- | passing |
31
-
32
- Scenario Outline: name # features/multiline_name.feature:21
33
- Given <state> without a table # features/step_definitions/sample_steps.rb:12
34
-
35
- Examples: I'm a multiline name
36
- which goes on and on and on for three lines
37
- yawn
38
- | state |
39
- | passing |
40
-
41
- 3 scenarios (3 passed)
42
- 6 steps (6 passed)
43
-
44
- """
@@ -1,169 +0,0 @@
1
- Feature: Cucumber command line
2
- In order to be able to write an editor plugin that can jump between
3
- steps and step definitions, Cucumber must provide a way to
4
- display how they are related.
5
-
6
- Scenario: List usage of step definitions
7
- When I run cucumber features --format usage --dry-run
8
- Then STDERR should be empty
9
- And it should pass with
10
- """
11
- -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
12
-
13
- /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
14
- Given '10' cukes # features/background/background_with_name.feature:4
15
- Given '10' cukes # features/background/background_with_name.feature:4
16
- And '10' cukes # features/background/failing_background.feature:6
17
- And '10' cukes # features/background/failing_background.feature:6
18
- And '10' cukes # features/background/failing_background.feature:6
19
- Given '10' cukes # features/background/passing_background.feature:4
20
- Given '10' cukes # features/background/passing_background.feature:4
21
- Given '10' cukes # features/background/passing_background.feature:4
22
- Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
23
- Given '2' cukes # features/tons_of_cukes.feature:4
24
- Given '2' cukes # features/tons_of_cukes.feature:5
25
- Given '2' cukes # features/tons_of_cukes.feature:6
26
- Given '2' cukes # features/tons_of_cukes.feature:7
27
- Given '2' cukes # features/tons_of_cukes.feature:8
28
- Given '2' cukes # features/tons_of_cukes.feature:9
29
- Given '2' cukes # features/tons_of_cukes.feature:10
30
- Given '2' cukes # features/tons_of_cukes.feature:11
31
- Given '2' cukes # features/tons_of_cukes.feature:12
32
- Given '2' cukes # features/tons_of_cukes.feature:13
33
- Given '2' cukes # features/tons_of_cukes.feature:14
34
- Given '2' cukes # features/tons_of_cukes.feature:15
35
- Given '2' cukes # features/tons_of_cukes.feature:16
36
- Given '2' cukes # features/tons_of_cukes.feature:17
37
- Given '2' cukes # features/tons_of_cukes.feature:18
38
- Given '2' cukes # features/tons_of_cukes.feature:19
39
- Given '2' cukes # features/tons_of_cukes.feature:20
40
- Given '2' cukes # features/tons_of_cukes.feature:21
41
- Given '2' cukes # features/tons_of_cukes.feature:22
42
- Given '2' cukes # features/tons_of_cukes.feature:23
43
- Given '2' cukes # features/tons_of_cukes.feature:24
44
- Given '2' cukes # features/tons_of_cukes.feature:25
45
- Given '2' cukes # features/tons_of_cukes.feature:26
46
- Given '2' cukes # features/tons_of_cukes.feature:27
47
- Given '2' cukes # features/tons_of_cukes.feature:28
48
- Given '2' cukes # features/tons_of_cukes.feature:29
49
- Given '2' cukes # features/tons_of_cukes.feature:30
50
- Given '2' cukes # features/tons_of_cukes.feature:31
51
- Given '2' cukes # features/tons_of_cukes.feature:32
52
- Given '2' cukes # features/tons_of_cukes.feature:33
53
- Given '2' cukes # features/tons_of_cukes.feature:34
54
- Given '2' cukes # features/tons_of_cukes.feature:35
55
- Given '2' cukes # features/tons_of_cukes.feature:36
56
- Given '2' cukes # features/tons_of_cukes.feature:37
57
- Given '2' cukes # features/tons_of_cukes.feature:38
58
- Given '2' cukes # features/tons_of_cukes.feature:39
59
- Given '2' cukes # features/tons_of_cukes.feature:40
60
- Given '2' cukes # features/tons_of_cukes.feature:41
61
- Given '2' cukes # features/tons_of_cukes.feature:42
62
- Given '2' cukes # features/tons_of_cukes.feature:43
63
- Given '2' cukes # features/tons_of_cukes.feature:44
64
- Given '2' cukes # features/tons_of_cukes.feature:45
65
- Given '2' cukes # features/tons_of_cukes.feature:46
66
- Given '2' cukes # features/tons_of_cukes.feature:47
67
- Given '2' cukes # features/tons_of_cukes.feature:48
68
- Given '2' cukes # features/tons_of_cukes.feature:49
69
- Given '2' cukes # features/tons_of_cukes.feature:50
70
- Given '2' cukes # features/tons_of_cukes.feature:51
71
- Given '2' cukes # features/tons_of_cukes.feature:52
72
- /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
73
- And '10' global cukes # features/background/failing_background_after_success.feature:5
74
- And '10' global cukes # features/background/failing_background_after_success.feature:5
75
- And '10' global cukes # features/background/failing_background_after_success.feature:5
76
- /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
77
- Then I should have '10' cukes # features/background/background_with_name.feature:7
78
- Then I should have '10' cukes # features/background/failing_background.feature:9
79
- Then I should have '10' cukes # features/background/failing_background.feature:12
80
- Then I should have '10' cukes # features/background/passing_background.feature:7
81
- Then I should have '10' cukes # features/background/passing_background.feature:10
82
- Then I should have '10' cukes # features/background/pending_background.feature:7
83
- Then I should have '10' cukes # features/background/pending_background.feature:10
84
- /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
85
- Then I should have '10' global cukes # features/background/failing_background_after_success.feature:8
86
- Then I should have '10' global cukes # features/background/failing_background_after_success.feature:11
87
- /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
88
- Given a step definition that calls an undefined step # features/call_undefined_step_from_step_def.feature:4
89
- /^another unused$/ # features/step_definitions/sample_steps.rb:69
90
- NOT MATCHED BY ANY STEPS
91
- /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
92
- Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
93
- /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
94
- Given failing expectation # features/failing_expectation.feature:4
95
- /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
96
- Given failing without a table # features/background/failing_background.feature:5
97
- Given failing without a table # features/background/failing_background.feature:5
98
- Given failing without a table # features/background/failing_background.feature:5
99
- Given failing without a table # features/background/scenario_outline_failing_background.feature:4
100
- Given failing without a table # features/search_sample.feature:10
101
- /^failing$/ # features/step_definitions/sample_steps.rb:8
102
- Given failing # features/sample.feature:18
103
- /^multiline string$/ # features/step_definitions/sample_steps.rb:50
104
- And multiline string # features/background/multiline_args_background.feature:7
105
- And multiline string # features/background/multiline_args_background.feature:7
106
- And multiline string # features/background/multiline_args_background.feature:7
107
- /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
108
- Given passing without a table # features/background/background_tagged_before_on_outline.feature:5
109
- Given passing without a table # features/background/failing_background_after_success.feature:4
110
- Given passing without a table # features/background/failing_background_after_success.feature:4
111
- Given passing without a table # features/background/failing_background_after_success.feature:4
112
- Given passing without a table # features/multiline_name.feature:6
113
- Given passing without a table # features/multiline_name.feature:6
114
- Given passing without a table # features/multiline_name.feature:11
115
- Given passing without a table # features/search_sample.feature:4
116
- Given passing without a table # features/search_sample.feature:4
117
- Given passing without a table # features/search_sample.feature:7
118
- Given passing without a table # features/search_sample.feature:4
119
- /^passing$/ # features/step_definitions/sample_steps.rb:5
120
- Given passing # features/sample.feature:12
121
- /^table$/ # features/step_definitions/sample_steps.rb:46
122
- Given table # features/background/multiline_args_background.feature:4
123
- Given table # features/background/multiline_args_background.feature:4
124
- Given table # features/background/multiline_args_background.feature:4
125
- /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
126
- Then the multiline string should be # features/background/multiline_args_background.feature:17
127
- Then the multiline string should be # features/background/multiline_args_background.feature:27
128
- /^the table should be$/ # features/step_definitions/sample_steps.rb:54
129
- Then the table should be # features/background/multiline_args_background.feature:14
130
- Then the table should be # features/background/multiline_args_background.feature:24
131
- /^unused$/ # features/step_definitions/sample_steps.rb:66
132
- NOT MATCHED BY ANY STEPS
133
-
134
- 43 scenarios (32 skipped, 10 undefined, 1 passed)
135
- 131 steps (117 skipped, 14 undefined)
136
-
137
- """
138
-
139
- Scenario: --format stepdefs
140
- When I run cucumber features --format stepdefs --dry-run
141
- Then STDERR should be empty
142
- And it should pass with
143
- """
144
- -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
145
-
146
- /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
147
- /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
148
- /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
149
- /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
150
- /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
151
- /^another unused$/ # features/step_definitions/sample_steps.rb:69
152
- NOT MATCHED BY ANY STEPS
153
- /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
154
- /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
155
- /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
156
- /^failing$/ # features/step_definitions/sample_steps.rb:8
157
- /^multiline string$/ # features/step_definitions/sample_steps.rb:50
158
- /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
159
- /^passing$/ # features/step_definitions/sample_steps.rb:5
160
- /^table$/ # features/step_definitions/sample_steps.rb:46
161
- /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
162
- /^the table should be$/ # features/step_definitions/sample_steps.rb:54
163
- /^unused$/ # features/step_definitions/sample_steps.rb:66
164
- NOT MATCHED BY ANY STEPS
165
-
166
- 43 scenarios (32 skipped, 10 undefined, 1 passed)
167
- 131 steps (117 skipped, 14 undefined)
168
-
169
- """
@@ -1,8 +0,0 @@
1
- Feature: A py string feature
2
-
3
- Scenario:
4
- Then I should see
5
- """
6
- a string
7
- """
8
-
@@ -1,12 +0,0 @@
1
- @background_tagged_before_on_outline
2
- Feature: Background tagged Before on Outline
3
-
4
- Background:
5
- Given passing without a table
6
-
7
- Scenario Outline: passing background
8
- Then I should have '<count>' cukes
9
-
10
- Examples:
11
- | count |
12
- | 888 |
@@ -1,7 +0,0 @@
1
- Feature: background with name
2
-
3
- Background: I'm a background and I'm ok
4
- Given '10' cukes
5
-
6
- Scenario: example
7
- Then I should have '10' cukes
@@ -1,12 +0,0 @@
1
- @after_file
2
- Feature: Failing background sample
3
-
4
- Background:
5
- Given failing without a table
6
- And '10' cukes
7
-
8
- Scenario: failing background
9
- Then I should have '10' cukes
10
-
11
- Scenario: another failing background
12
- Then I should have '10' cukes
@@ -1,11 +0,0 @@
1
- Feature: Failing background after previously successful background sample
2
-
3
- Background:
4
- Given passing without a table
5
- And '10' global cukes
6
-
7
- Scenario: passing background
8
- Then I should have '10' global cukes
9
-
10
- Scenario: failing background
11
- Then I should have '10' global cukes
@@ -1,32 +0,0 @@
1
- Feature: Passing background with multiline args
2
-
3
- Background:
4
- Given table
5
- |a|b|
6
- |c|d|
7
- And multiline string
8
- """
9
- I'm a cucumber and I'm okay.
10
- I sleep all night and I test all day
11
- """
12
-
13
- Scenario: passing background
14
- Then the table should be
15
- |a|b|
16
- |c|d|
17
- Then the multiline string should be
18
- """
19
- I'm a cucumber and I'm okay.
20
- I sleep all night and I test all day
21
- """
22
-
23
- Scenario: another passing background
24
- Then the table should be
25
- |a|b|
26
- |c|d|
27
- Then the multiline string should be
28
- """
29
- I'm a cucumber and I'm okay.
30
- I sleep all night and I test all day
31
- """
32
-
@@ -1,10 +0,0 @@
1
- Feature: Passing background sample
2
-
3
- Background:
4
- Given '10' cukes
5
-
6
- Scenario: passing background
7
- Then I should have '10' cukes
8
-
9
- Scenario: another passing background
10
- Then I should have '10' cukes
@@ -1,10 +0,0 @@
1
- Feature: Pending background sample
2
-
3
- Background:
4
- Given pending
5
-
6
- Scenario: pending background
7
- Then I should have '10' cukes
8
-
9
- Scenario: another pending background
10
- Then I should have '10' cukes
@@ -1,16 +0,0 @@
1
- Feature: Failing background with scenario outlines sample
2
-
3
- Background:
4
- Given failing without a table
5
-
6
- Scenario Outline: failing background
7
- Then I should have '<count>' cukes
8
- Examples:
9
- |count|
10
- | 10 |
11
-
12
- Scenario Outline: another failing background
13
- Then I should have '<count>' cukes
14
- Examples:
15
- |count|
16
- | 10 |
@@ -1,16 +0,0 @@
1
- Feature: Passing background with scenario outlines sample
2
-
3
- Background:
4
- Given '10' cukes
5
-
6
- Scenario Outline: passing background
7
- Then I should have '<count>' cukes
8
- Examples:
9
- |count|
10
- | 10 |
11
-
12
- Scenario Outline: another passing background
13
- Then I should have '<count>' cukes
14
- Examples:
15
- |count|
16
- | 10 |
@@ -1,23 +0,0 @@
1
- require 'forwardable'
2
-
3
- module Cucumber
4
- module Formatter
5
- # Adapter to make #puts/#print/#flush work with win32console
6
- class ColorIO #:nodoc:
7
- extend Forwardable
8
- def_delegators :@kernel, :puts, :print # win32console colours only work when sent to Kernel
9
- def_delegators :@stdout, :flush, :tty?, :write, :close
10
-
11
- def initialize(kernel, stdout)
12
- @kernel = kernel
13
- @stdout = stdout
14
- end
15
-
16
- # Ensure using << still gets colours in win32console
17
- def <<(output)
18
- print(output)
19
- self
20
- end
21
- end
22
- end
23
- end
@@ -1,35 +0,0 @@
1
- require 'cucumber/formatter/io'
2
- require 'cucumber/formatter/pretty'
3
-
4
- module Cucumber
5
- module Formatter
6
- # The formatter used for <tt>--format tag_cloud</tt>
7
- # Custom formatter that prints a tag cloud as a table.
8
- class TagCloud
9
- include Io
10
-
11
- def initialize(step_mother, path_or_io, options)
12
- @io = ensure_io(path_or_io, "tag_cloud")
13
- @options = options
14
- @counts = Hash.new{|h,k| h[k] = 0}
15
- end
16
-
17
- def after_features(features)
18
- print_summary(features)
19
- end
20
-
21
- def tag_name(tag_name)
22
- @counts[tag_name] += 1
23
- end
24
-
25
- private
26
-
27
- def print_summary(features)
28
- matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
29
- table = Cucumber::Ast::Table.new(matrix)
30
- formatter = Cucumber::Formatter::Pretty.new(@step_mother, @io, {})
31
- Cucumber::Ast::TreeWalker.new(@step_mother, [formatter]).visit_multiline_arg(table)
32
- end
33
- end
34
- end
35
- end
@@ -1,29 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
- require 'cucumber/formatter/color_io'
3
-
4
- module Cucumber
5
- module Formatter
6
- describe ColorIO do
7
- describe "<<" do
8
- it "should convert to a print using kernel" do
9
- kernel = mock('Kernel')
10
- color_io = ColorIO.new(kernel, nil)
11
-
12
- kernel.should_receive(:print).with("monkeys")
13
-
14
- color_io << "monkeys"
15
- end
16
-
17
- it "should allow chained <<" do
18
- kernel = mock('Kernel')
19
- color_io = ColorIO.new(kernel, nil)
20
-
21
- kernel.should_receive(:print).with("monkeys")
22
- kernel.should_receive(:print).with(" are tasty")
23
-
24
- color_io << "monkeys" << " are tasty"
25
- end
26
- end
27
- end
28
- end
29
- end