aslakhellesoy-cucumber 0.1.99.3 → 0.1.99.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. data/Manifest.txt +6 -0
  2. metadata +1 -1
  3. data/cucumber.yml +0 -1
  4. data/examples/cs/README.textile +0 -1
  5. data/examples/cs/Rakefile +0 -12
  6. data/examples/cs/compile.bat +0 -1
  7. data/examples/cs/features/addition.feature +0 -16
  8. data/examples/cs/features/step_definitons/calculator_steps.rb +0 -19
  9. data/examples/cs/src/demo/Calculator.cs +0 -20
  10. data/examples/dos_line_endings/Rakefile +0 -6
  11. data/examples/dos_line_endings/features/dos_line_endings.feature +0 -9
  12. data/examples/i18n/README.textile +0 -18
  13. data/examples/i18n/Rakefile +0 -32
  14. data/examples/i18n/ar/Rakefile +0 -6
  15. data/examples/i18n/ar/features/addition.feature +0 -17
  16. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +0 -28
  17. data/examples/i18n/ar/lib/calculator.rb +0 -10
  18. data/examples/i18n/da/Rakefile +0 -6
  19. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +0 -24
  20. data/examples/i18n/da/features/summering.feature +0 -17
  21. data/examples/i18n/da/lib/kalkulator.rb +0 -11
  22. data/examples/i18n/de/Rakefile +0 -6
  23. data/examples/i18n/de/features/addition.feature +0 -16
  24. data/examples/i18n/de/features/division.feature +0 -9
  25. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +0 -24
  26. data/examples/i18n/de/lib/calculator.rb +0 -14
  27. data/examples/i18n/en/Rakefile +0 -6
  28. data/examples/i18n/en/features/addition.feature +0 -16
  29. data/examples/i18n/en/features/division.feature +0 -9
  30. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +0 -24
  31. data/examples/i18n/en/lib/calculator.rb +0 -14
  32. data/examples/i18n/es/Rakefile +0 -6
  33. data/examples/i18n/es/features/adicion.feature +0 -17
  34. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +0 -24
  35. data/examples/i18n/es/lib/calculador.rb +0 -11
  36. data/examples/i18n/et/Rakefile +0 -6
  37. data/examples/i18n/et/features/liitmine.feature +0 -17
  38. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +0 -24
  39. data/examples/i18n/et/lib/kalkulaator.rb +0 -10
  40. data/examples/i18n/fi/Rakefile +0 -6
  41. data/examples/i18n/fi/features/jakolasku.feature +0 -9
  42. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +0 -24
  43. data/examples/i18n/fi/features/yhteenlasku.feature +0 -16
  44. data/examples/i18n/fi/lib/laskin.rb +0 -14
  45. data/examples/i18n/fr/Rakefile +0 -6
  46. data/examples/i18n/fr/features/addition.feature +0 -15
  47. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +0 -27
  48. data/examples/i18n/fr/lib/calculatrice.rb +0 -10
  49. data/examples/i18n/id/Rakefile +0 -6
  50. data/examples/i18n/id/features/addition.feature +0 -16
  51. data/examples/i18n/id/features/division.feature +0 -9
  52. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +0 -24
  53. data/examples/i18n/id/lib/calculator.rb +0 -14
  54. data/examples/i18n/it/Rakefile +0 -6
  55. data/examples/i18n/it/features/somma.feature +0 -10
  56. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +0 -24
  57. data/examples/i18n/it/lib/calcolatrice.rb +0 -11
  58. data/examples/i18n/ja/README.txt +0 -5
  59. data/examples/i18n/ja/Rakefile +0 -6
  60. data/examples/i18n/ja/features/addition.feature +0 -16
  61. data/examples/i18n/ja/features/division.feature +0 -9
  62. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +0 -24
  63. data/examples/i18n/ja/lib/calculator.rb +0 -14
  64. data/examples/i18n/ko/Rakefile +0 -6
  65. data/examples/i18n/ko/features/addition.feature +0 -16
  66. data/examples/i18n/ko/features/division.feature +0 -10
  67. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +0 -24
  68. data/examples/i18n/ko/lib/calculator.rb +0 -14
  69. data/examples/i18n/lt/Rakefile +0 -6
  70. data/examples/i18n/lt/features/addition.feature +0 -17
  71. data/examples/i18n/lt/features/division.feature +0 -9
  72. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +0 -24
  73. data/examples/i18n/lt/lib/calculator.rb +0 -14
  74. data/examples/i18n/no/Rakefile +0 -6
  75. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +0 -24
  76. data/examples/i18n/no/features/summering.feature +0 -18
  77. data/examples/i18n/no/lib/kalkulator.rb +0 -11
  78. data/examples/i18n/pt/Rakefile +0 -6
  79. data/examples/i18n/pt/features/adicao.feature +0 -10
  80. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +0 -24
  81. data/examples/i18n/pt/lib/calculadora.rb +0 -10
  82. data/examples/i18n/ro/Rakefile +0 -6
  83. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +0 -24
  84. data/examples/i18n/ro/features/suma.feature +0 -10
  85. data/examples/i18n/ro/lib/calculator.rb +0 -11
  86. data/examples/i18n/se/Rakefile +0 -6
  87. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +0 -24
  88. data/examples/i18n/se/features/summering.feature +0 -17
  89. data/examples/i18n/se/lib/kalkulator.rb +0 -11
  90. data/examples/i18n/zh-CN/Rakefile +0 -6
  91. data/examples/i18n/zh-CN/features/addition.feature +0 -17
  92. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +0 -26
  93. data/examples/i18n/zh-CN/lib/calculator.rb +0 -10
  94. data/examples/java/README.textile +0 -22
  95. data/examples/java/Rakefile +0 -12
  96. data/examples/java/features/hello.feature +0 -11
  97. data/examples/java/features/step_definitons/hello_steps.rb +0 -25
  98. data/examples/java/features/step_definitons/tree_steps.rb +0 -14
  99. data/examples/java/features/tree.feature +0 -9
  100. data/examples/jbehave/README.textile +0 -17
  101. data/examples/jbehave/features/support/env.rb +0 -7
  102. data/examples/jbehave/features/trading.feature +0 -24
  103. data/examples/jbehave/pom.xml +0 -48
  104. data/examples/selenium/Rakefile +0 -6
  105. data/examples/selenium/features/search.feature +0 -9
  106. data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
  107. data/examples/self_test/README.textile +0 -6
  108. data/examples/self_test/features/call_undefined_step_from_step_def.feature +0 -7
  109. data/examples/self_test/features/lots_of_undefined.feature +0 -8
  110. data/examples/self_test/features/outline_sample.feature +0 -12
  111. data/examples/self_test/features/sample.feature +0 -16
  112. data/examples/self_test/features/step_definitions/sample_steps.rb +0 -25
  113. data/examples/test_unit/Rakefile +0 -6
  114. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +0 -26
  115. data/examples/test_unit/features/test_unit.feature +0 -9
  116. data/examples/tickets/Rakefile +0 -11
  117. data/examples/tickets/cucumber.yml +0 -2
  118. data/examples/tickets/features/lib/eatting_machine.rb +0 -18
  119. data/examples/tickets/features/lib/pantry.rb +0 -20
  120. data/examples/tickets/features/scenario_outline.feature +0 -90
  121. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +0 -42
  122. data/examples/tickets/features/step_definitons/tickets_steps.rb +0 -61
  123. data/examples/tickets/features/tickets.feature +0 -28
  124. data/examples/watir/README.textile +0 -16
  125. data/examples/watir/Rakefile +0 -6
  126. data/examples/watir/features/search.feature +0 -9
  127. data/examples/watir/features/step_definitons/search_steps.rb +0 -24
  128. data/examples/watir/features/support/env.rb +0 -32
  129. data/features/cucumber_cli.feature +0 -327
  130. data/features/cucumber_cli_outlines.feature +0 -81
  131. data/features/report_called_undefined_steps.feature +0 -32
  132. data/features/step_definitions/cucumber_steps.rb +0 -31
  133. data/features/step_definitions/extra_steps.rb +0 -2
  134. data/features/support/env.rb +0 -7
  135. data/gem_tasks/deployment.rake +0 -11
  136. data/gem_tasks/environment.rake +0 -7
  137. data/gem_tasks/features.rake +0 -6
  138. data/gem_tasks/fix_cr_lf.rake +0 -10
  139. data/gem_tasks/flog.rake +0 -4
  140. data/gem_tasks/gemspec.rake +0 -10
  141. data/gem_tasks/rspec.rake +0 -35
  142. data/gem_tasks/yard.rake +0 -8
  143. data/lib/autotest/cucumber.rb +0 -6
  144. data/lib/autotest/cucumber_mixin.rb +0 -124
  145. data/lib/autotest/cucumber_rails.rb +0 -6
  146. data/lib/autotest/cucumber_rails_rspec.rb +0 -6
  147. data/lib/autotest/cucumber_rspec.rb +0 -6
  148. data/lib/autotest/discover.rb +0 -9
  149. data/lib/cucumber/ast/comment.rb +0 -26
  150. data/lib/cucumber/ast/examples.rb +0 -22
  151. data/lib/cucumber/ast/feature.rb +0 -60
  152. data/lib/cucumber/ast/features.rb +0 -39
  153. data/lib/cucumber/ast/filter.rb +0 -22
  154. data/lib/cucumber/ast/outline_table.rb +0 -49
  155. data/lib/cucumber/ast/py_string.rb +0 -52
  156. data/lib/cucumber/ast/scenario.rb +0 -95
  157. data/lib/cucumber/ast/scenario_outline.rb +0 -83
  158. data/lib/cucumber/ast/step.rb +0 -139
  159. data/lib/cucumber/ast/table.rb +0 -214
  160. data/lib/cucumber/ast/tags.rb +0 -33
  161. data/lib/cucumber/ast/visitor.rb +0 -93
  162. data/lib/cucumber/ast.rb +0 -27
  163. data/lib/cucumber/broadcaster.rb +0 -15
  164. data/lib/cucumber/cli.rb +0 -410
  165. data/lib/cucumber/core_ext/exception.rb +0 -53
  166. data/lib/cucumber/core_ext/instance_exec.rb +0 -54
  167. data/lib/cucumber/core_ext/proc.rb +0 -33
  168. data/lib/cucumber/core_ext/string.rb +0 -48
  169. data/lib/cucumber/formatter/ansicolor.rb +0 -106
  170. data/lib/cucumber/formatter/console.rb +0 -116
  171. data/lib/cucumber/formatter/pretty.rb +0 -158
  172. data/lib/cucumber/formatter/profile.rb +0 -77
  173. data/lib/cucumber/formatter/progress.rb +0 -68
  174. data/lib/cucumber/formatter/rerun.rb +0 -35
  175. data/lib/cucumber/formatter.rb +0 -1
  176. data/lib/cucumber/formatters/autotest_formatter.rb +0 -21
  177. data/lib/cucumber/formatters/cucumber.css +0 -132
  178. data/lib/cucumber/formatters/cucumber.js +0 -11
  179. data/lib/cucumber/formatters/html_formatter.rb +0 -152
  180. data/lib/cucumber/formatters/jquery.js +0 -32
  181. data/lib/cucumber/formatters/pretty_formatter.rb +0 -285
  182. data/lib/cucumber/formatters/unicode.rb +0 -35
  183. data/lib/cucumber/jbehave.rb +0 -104
  184. data/lib/cucumber/languages.yml +0 -314
  185. data/lib/cucumber/parser/basic.rb +0 -0
  186. data/lib/cucumber/parser/feature.rb +0 -1315
  187. data/lib/cucumber/parser/feature.tt +0 -160
  188. data/lib/cucumber/parser/i18n.tt +0 -27
  189. data/lib/cucumber/parser/table.rb +0 -396
  190. data/lib/cucumber/parser/table.tt +0 -53
  191. data/lib/cucumber/parser/treetop_ext.rb +0 -67
  192. data/lib/cucumber/parser.rb +0 -24
  193. data/lib/cucumber/platform.rb +0 -18
  194. data/lib/cucumber/rails/rspec.rb +0 -5
  195. data/lib/cucumber/rails/world.rb +0 -73
  196. data/lib/cucumber/rake/task.rb +0 -106
  197. data/lib/cucumber/step_definition.rb +0 -87
  198. data/lib/cucumber/step_mother.rb +0 -164
  199. data/lib/cucumber/treetop_parser/feature_fi.rb +0 -1951
  200. data/lib/cucumber/version.rb +0 -10
  201. data/lib/cucumber.rb +0 -72
  202. data/pretty.txt +0 -486
  203. data/rails_generators/cucumber/USAGE +0 -11
  204. data/rails_generators/cucumber/cucumber_generator.rb +0 -31
  205. data/rails_generators/cucumber/templates/cucumber +0 -8
  206. data/rails_generators/cucumber/templates/cucumber.rake +0 -7
  207. data/rails_generators/cucumber/templates/env.rb +0 -16
  208. data/rails_generators/cucumber/templates/paths.rb +0 -12
  209. data/rails_generators/cucumber/templates/webrat_steps.rb +0 -99
  210. data/rails_generators/feature/USAGE +0 -12
  211. data/rails_generators/feature/feature_generator.rb +0 -36
  212. data/rails_generators/feature/templates/feature.erb +0 -31
  213. data/rails_generators/feature/templates/steps.erb +0 -24
  214. data/spec/cucumber/ast/feature_factory.rb +0 -54
  215. data/spec/cucumber/ast/feature_spec.rb +0 -60
  216. data/spec/cucumber/ast/py_string_spec.rb +0 -40
  217. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -64
  218. data/spec/cucumber/ast/scenario_spec.rb +0 -82
  219. data/spec/cucumber/ast/step_spec.rb +0 -45
  220. data/spec/cucumber/ast/table_spec.rb +0 -81
  221. data/spec/cucumber/broadcaster_spec.rb +0 -14
  222. data/spec/cucumber/cli_spec.rb +0 -416
  223. data/spec/cucumber/core_ext/proc_spec.rb +0 -37
  224. data/spec/cucumber/core_ext/string_spec.rb +0 -42
  225. data/spec/cucumber/formatter/ansicolor_spec.rb +0 -35
  226. data/spec/cucumber/formatter/html/cucumber.css +0 -37
  227. data/spec/cucumber/formatter/html/cucumber.js +0 -11
  228. data/spec/cucumber/formatter/html/index.html +0 -45
  229. data/spec/cucumber/formatter/html/jquery-1.3.min.js +0 -19
  230. data/spec/cucumber/formatter/html/jquery.uitableedit.js +0 -100
  231. data/spec/cucumber/formatters/autotest_formatter_spec.rb +0 -27
  232. data/spec/cucumber/formatters/features.html +0 -269
  233. data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
  234. data/spec/cucumber/parser/feature_parser_spec.rb +0 -247
  235. data/spec/cucumber/parser/table_parser_spec.rb +0 -48
  236. data/spec/cucumber/rails/stubs/mini_rails.rb +0 -18
  237. data/spec/cucumber/rails/stubs/test_help.rb +0 -1
  238. data/spec/cucumber/rails/world_spec.rb +0 -11
  239. data/spec/cucumber/sell_cucumbers.feature +0 -19
  240. data/spec/cucumber/step_definition_spec.rb +0 -62
  241. data/spec/cucumber/step_mom_spec.rb +0 -49
  242. data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
  243. data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
  244. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
  245. data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
  246. data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
  247. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
  248. data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
  249. data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
  250. data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
  251. data/spec/cucumber/treetop_parser/spaces.feature +0 -12
  252. data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
  253. data/spec/cucumber/treetop_parser/with_comments.feature +0 -10
  254. data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
  255. data/spec/cucumber/world/pending_spec.rb +0 -47
  256. data/spec/spec.opts +0 -2
  257. data/spec/spec_helper.rb +0 -21
@@ -1,416 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'yaml'
3
-
4
- module Cucumber
5
- describe CLI do
6
-
7
- def mock_executor(stubs = {})
8
- stub('executor', {:visit_features => nil, :lines_for_features= => nil, :failed => false, :formatters= => nil}.merge(stubs))
9
- end
10
-
11
- def mock_broadcaster(stubs = {})
12
- stub(Broadcaster, {:register => nil}.merge(stubs))
13
- end
14
-
15
- def mock_features(stubs ={})
16
- stub('features', {:<< => nil}.merge(stubs))
17
- end
18
-
19
- before(:each) do
20
- Kernel.stub!(:exit).and_return(nil)
21
- end
22
-
23
- def given_cucumber_yml_defined_as(hash_or_string)
24
- File.stub!(:exist?).and_return(true)
25
- cucumber_yml = hash_or_string.is_a?(Hash) ? hash_or_string.to_yaml : hash_or_string
26
- IO.stub!(:read).with('cucumber.yml').and_return(cucumber_yml)
27
- end
28
-
29
- it "should expand args from YAML file" do
30
- cli = CLI.new
31
-
32
- given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
33
-
34
- cli.parse_options!(%w{--format progress --profile bongo})
35
- cli.options[:formats].should == {'progress' => STDOUT}
36
- cli.options[:require].should == ['from/yml']
37
- end
38
-
39
- it "should expand args from YAML file's default if there are no args" do
40
- cli = CLI.new
41
-
42
- given_cucumber_yml_defined_as({'default' => '--require from/yml'})
43
-
44
- cli.parse_options!([])
45
- cli.options[:require].should == ['from/yml']
46
- end
47
-
48
- it "should provide a helpful error message when a specified profile does not exists in YAML file" do
49
- cli = CLI.new(StringIO.new, error = StringIO.new)
50
-
51
- given_cucumber_yml_defined_as({'default' => '--require from/yml', 'html_report' => '--format html'})
52
-
53
- cli.parse_options!(%w{--profile i_do_not_exist})
54
-
55
- expected_message = <<-END_OF_MESSAGE
56
- Could not find profile: 'i_do_not_exist'
57
-
58
- Defined profiles in cucumber.yml:
59
- * default
60
- * html_report
61
- END_OF_MESSAGE
62
-
63
- error.string.should == expected_message
64
- end
65
-
66
- it "should provide a helpful error message when a specified profile is not a String" do
67
- cli = CLI.new(StringIO.new, error = StringIO.new)
68
-
69
- given_cucumber_yml_defined_as({'foo' => [1,2,3]})
70
-
71
- cli.parse_options!(%w{--profile foo})
72
-
73
- error.string.should == "Profiles must be defined as a String. The 'foo' profile was [1, 2, 3] (Array).\n"
74
- end
75
-
76
- it "should provide a helpful error message when a specified profile exists but is nil or blank" do
77
- [nil, ' '].each do |bad_input|
78
- cli = CLI.new(StringIO.new, error = StringIO.new)
79
-
80
- given_cucumber_yml_defined_as({'foo' => bad_input})
81
-
82
- cli.parse_options!(%w{--profile foo})
83
-
84
- error.string.should match(/The 'foo' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml./)
85
- end
86
- end
87
-
88
- it "should provide a helpful error message when no YAML file exists and a profile is specified" do
89
- cli = CLI.new(StringIO.new, error = StringIO.new)
90
-
91
- File.should_receive(:exist?).with('cucumber.yml').and_return(false)
92
-
93
- cli.parse_options!(%w{--profile i_do_not_exist})
94
-
95
- error.string.should match(/cucumber.yml was not found. Please refer to cucumber's documentaion on defining profiles in cucumber.yml./)
96
- end
97
-
98
- it "should provide a helpful error message when cucumber.yml is blank or malformed" do
99
- expected_error_message = /cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentaion on correct profile usage./
100
-
101
- ['', 'sfsadfs', "--- \n- an\n- array\n", "---dddfd"].each do |bad_input|
102
- cli = CLI.new(StringIO.new, error = StringIO.new)
103
-
104
- given_cucumber_yml_defined_as(bad_input)
105
- cli.parse_options!([])
106
-
107
- error.string.should match(expected_error_message)
108
- end
109
- end
110
-
111
- it "should procide a helpful error message when the YAML can not be parsed" do
112
- expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentaion on correct profile usage./
113
- cli = CLI.new(StringIO.new, error = StringIO.new)
114
-
115
- given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
116
- YAML.should_receive(:load).and_raise Exception
117
-
118
- cli.parse_options!([])
119
-
120
- error.string.should match(expected_error_message)
121
- end
122
-
123
- it "should accept --dry-run option" do
124
- cli = CLI.new(StringIO.new)
125
- cli.parse_options!(%w{--dry-run})
126
- cli.options[:dry_run].should be_true
127
- cli.execute!(stub('step mother'))
128
- end
129
-
130
- it "should accept --no-source option" do
131
- cli = CLI.new
132
- cli.parse_options!(%w{--no-source})
133
-
134
- cli.options[:source].should be_false
135
- end
136
-
137
- it "should accept --no-snippets option" do
138
- cli = CLI.new
139
- cli.parse_options!(%w{--no-snippets})
140
-
141
- cli.options[:snippets].should be_false
142
- end
143
-
144
- it "should set snippets and source to false with --quiet option" do
145
- cli = CLI.new
146
- cli.parse_options!(%w{--quiet})
147
-
148
- cli.options[:snippets].should be_nil
149
- cli.options[:source].should be_nil
150
- end
151
-
152
- it "should accept --verbose option" do
153
- cli = CLI.new
154
- cli.parse_options!(%w{--verbose})
155
-
156
- cli.options[:verbose].should be_true
157
- end
158
-
159
- it "should require files in support paths first" do
160
- File.stub!(:directory?).and_return(true)
161
- Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/env.rb"])
162
-
163
- cli = CLI.new(StringIO.new)
164
- cli.parse_options!(%w{--require /features})
165
-
166
- cli.should_receive(:require).with("/features/support/env.rb").ordered
167
- cli.should_receive(:require).with("/features/step_definitions/foo.rb").ordered
168
- cli.should_receive(:require).with("spec/expectations/differs/default").ordered
169
-
170
- cli.execute!(stub('step mother'))
171
- end
172
-
173
- describe "verbose mode" do
174
-
175
- before(:each) do
176
- @out = StringIO.new
177
- @cli = CLI.new(@out)
178
- @cli.stub!(:require)
179
- @empty_feature = Ast::Feature.new(Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
180
- Dir.stub!(:[])
181
- end
182
-
183
- it "should show ruby files required" do
184
- @cli.parse_options!(%w{--verbose --require example.rb})
185
- @cli.execute!(stub('step mother'))
186
-
187
- @out.string.should include('example.rb')
188
- end
189
-
190
- it "should show feature files parsed" do
191
- Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
192
-
193
- @cli.parse_options!(%w{--verbose example.feature})
194
- @cli.execute!(stub('step mother'))
195
-
196
- @out.string.should include('example.feature')
197
- end
198
-
199
- end
200
-
201
- it "should accept --out option" do
202
- cli = CLI.new(StringIO.new)
203
- cli.parse_options!(%w{--out jalla.txt})
204
- cli.options[:formats]['pretty'].should == 'jalla.txt'
205
- end
206
-
207
- it "should accept multiple --out options" do
208
- cli = CLI.new(StringIO.new)
209
- cli.parse_options!(%w{--format progress --out file1 --out file2})
210
- cli.options[:formats].should == {'progress' => 'file2'}
211
- end
212
-
213
- it "should accept multiple --format options" do
214
- cli = CLI.new(StringIO.new)
215
- cli.parse_options!(%w{--format pretty --format progress})
216
- cli.options[:formats].should have_key('pretty')
217
- cli.options[:formats].should have_key('progress')
218
- end
219
-
220
- it "should associate --out to previous --format" do
221
- cli = CLI.new(StringIO.new)
222
- cli.parse_options!(%w{--format progress --out file1 --format profile --out file2})
223
- cli.options[:formats].should == {"profile"=>"file2", "progress"=>"file1"}
224
- end
225
-
226
- describe "--format with class" do
227
-
228
- describe "in module" do
229
-
230
- it "should resolve each module until it gets Formatter class" do
231
- cli = CLI.new(nil)
232
- mock_module = mock('module')
233
- cli.parse_options!(%w{--format ZooModule::MonkeyFormatterClass})
234
- Object.stub!(:const_defined?).and_return(true)
235
- mock_module.stub!(:const_defined?).and_return(true)
236
-
237
- f = stub('formatter', :null_object => true)
238
-
239
- Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
240
- mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
241
-
242
- cli.execute!(stub('step mother'))
243
- end
244
-
245
- end
246
-
247
- describe "exists and valid constructor" do
248
-
249
- before(:each) do
250
- @mock_formatter_class = mock('formatter class')
251
- Object.stub!(:const_get).and_return(@mock_formatter_class)
252
- Object.stub!(:const_defined?).with('magical').and_return(true)
253
- end
254
-
255
- xit "should create the formatter" do
256
- cli = CLI.new
257
- mock_formatter = mock('magical formatter')
258
- cli.parse_options!(%w{--format magical})
259
-
260
- @mock_formatter_class.should_receive(:new)
261
-
262
- cli.execute!(stub('step mother'), mock_executor, stub('features'))
263
- end
264
-
265
- xit "should register the formatter with broadcaster" do
266
- cli = CLI.new
267
- broadcaster = Broadcaster.new
268
- mock_formatter = mock('magical formatter')
269
- Broadcaster.stub!(:new).and_return(broadcaster, stub("output broadcaster", :register => nil))
270
- @mock_formatter_class.stub!(:new).and_return(mock_formatter)
271
- cli.parse_options!(%w{--format magical})
272
-
273
- broadcaster.should_receive(:register).with(mock_formatter)
274
-
275
- cli.execute!(stub('step mother'), mock_executor, stub('features'))
276
- end
277
-
278
- end
279
-
280
- describe "exists but invalid constructor" do
281
-
282
- before(:each) do
283
- @out = StringIO.new
284
- @error = StringIO.new
285
- @cli = CLI.new(@out, @error)
286
-
287
- mock_formatter_class = stub('formatter class')
288
- mock_formatter_class.stub!(:new).and_raise("No such method")
289
- Object.stub!(:const_get).and_return(mock_formatter_class)
290
- Object.stub!(:const_defined?).with('exists_but_evil').and_return(true)
291
-
292
- @cli.parse_options!(%w{--format exists_but_evil})
293
- end
294
-
295
- xit "should show exception" do
296
- Kernel.stub!(:exit)
297
-
298
- @cli.execute!(stub('step mother'))
299
-
300
- @error.string.should include("No such method")
301
- end
302
-
303
- xit "should exit" do
304
- Kernel.should_receive(:exit)
305
-
306
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
307
- end
308
-
309
- end
310
-
311
- describe "non-existent" do
312
-
313
- before(:each) do
314
- @out = StringIO.new
315
- @error = StringIO.new
316
- @cli = CLI.new(@out, @error)
317
-
318
- @cli.parse_options!(%w{--format invalid})
319
- end
320
-
321
- xit "should display a format error" do
322
- Kernel.stub!(:exit)
323
-
324
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
325
-
326
- @error.string.should include("Invalid format: invalid\n")
327
- end
328
-
329
- xit "should display --help" do
330
- Kernel.stub!(:exit)
331
-
332
- @cli.execute!(stub('step mother'))
333
-
334
- @out.string.should include("Usage: cucumber")
335
- end
336
-
337
- xit "should exit" do
338
- Kernel.should_receive(:exit)
339
-
340
- @cli.execute!(stub('step mother'), mock_executor, stub('features'))
341
- end
342
-
343
- end
344
-
345
- end
346
-
347
- it "should accept multiple --scenario options" do
348
- cli = CLI.new
349
- cli.parse_options!(['--scenario', "User logs in", '--scenario', "User signs up"])
350
- cli.options[:scenario_names].should include("User logs in")
351
- cli.options[:scenario_names].should include("User signs up")
352
- end
353
-
354
- xit "should register --scenario options with the executor" do
355
- cli = CLI.new
356
- cli.parse_options!(['--scenario', "User logs in", '--scenario', "User signs up"])
357
- executor = mock_executor
358
- executor.should_receive(:scenario_names=).with(["User logs in", "User signs up"])
359
- cli.execute!(stub('step mother'), executor, stub('features'))
360
- end
361
-
362
- it "should accept --color option" do
363
- cli = CLI.new(StringIO.new)
364
- Term::ANSIColor.should_receive(:coloring=).with(true)
365
- cli.parse_options!(['--color'])
366
- end
367
-
368
- it "should accept --no-color option" do
369
- cli = CLI.new(StringIO.new)
370
- Term::ANSIColor.should_receive(:coloring=).with(false)
371
- cli.parse_options!(['--no-color'])
372
- end
373
-
374
- describe "--backtrace" do
375
- before do
376
- Exception.cucumber_full_backtrace = false
377
- end
378
-
379
- it "should show full backtrace when --backtrace is present" do
380
- cli = CLI.new
381
- cli.parse_options!(['--backtrace'])
382
- begin
383
- "x".should == "y"
384
- rescue => e
385
- e.backtrace[0].should_not == "#{__FILE__}:#{__LINE__ - 2}"
386
- end
387
- end
388
-
389
- xit "should strip gems when --backtrace is absent" do
390
- cli = CLI.new
391
- cli.parse_options!(['--'])
392
- begin
393
- "x".should == "y"
394
- rescue => e
395
- e.backtrace[0].should == "#{__FILE__}:#{__LINE__ - 2}"
396
- end
397
- end
398
-
399
- after do
400
- Exception.cucumber_full_backtrace = false
401
- end
402
- end
403
-
404
- it "should search for all features in the specified directory" do
405
- cli = CLI.new(StringIO.new)
406
-
407
- cli.parse_options!(%w{feature_directory/})
408
- File.stub!(:directory?).and_return(true)
409
-
410
- Dir.should_receive(:[]).with("feature_directory/**/*.feature").any_number_of_times.and_return([])
411
-
412
- cli.execute!(stub('step mother'))
413
- end
414
-
415
- end
416
- end
@@ -1,37 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/core_ext/instance_exec'
3
-
4
- describe Proc do
5
- it "should raise ArityMismatchError for too many args (expecting 0)" do
6
- lambda {
7
- Object.new.cucumber_instance_exec(true, 'foo', 1) do
8
- end
9
- }.should raise_error(Cucumber::ArityMismatchError, "expected 0 block argument(s), got 1")
10
- end
11
-
12
- it "should raise ArityMismatchError for too many args (expecting 1)" do
13
- lambda {
14
- Object.new.cucumber_instance_exec(true, 'foo', 1,2) do |a|
15
- end
16
- }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 2")
17
- end
18
-
19
- it "should raise ArityMismatchError for too few args (expecting 1)" do
20
- lambda {
21
- Object.new.cucumber_instance_exec(true, 'foo') do |a|
22
- end
23
- }.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 0")
24
- end
25
-
26
- it "should raise ArityMismatchError for too few args (expecting 2)" do
27
- lambda {
28
- Object.new.cucumber_instance_exec(true, 'foo', 1) do |a,b|
29
- end
30
- }.should raise_error(Cucumber::ArityMismatchError, "expected 2 block argument(s), got 1")
31
- end
32
-
33
- it "should remove extraneous path info for file" do
34
- proc = lambda {|a,b|}
35
- proc.file_colon_line.should == "spec/cucumber/core_ext/proc_spec.rb:34"
36
- end
37
- end
@@ -1,42 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../../lib/cucumber/core_ext/string'
2
-
3
- describe String, "#gzub" do
4
- it "should format groups with format string" do
5
- "I ate 1 egg this morning".gzub(/I (\w+) (\d+) (\w+) this (\w+)/, "<span>%s</span>").should ==
6
- "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
7
- end
8
-
9
- it "should format groups with format string when there are dupes" do
10
- "I bob 1 bo this bobs".gzub(/I (\w+) (\d+) (\w+) this (\w+)/, "<span>%s</span>").should ==
11
- "I <span>bob</span> <span>1</span> <span>bo</span> this <span>bobs</span>"
12
- end
13
-
14
- it "should format groups with block" do
15
- f = "I ate 1 egg this morning".gzub(/I (\w+) (\d+) (\w+) this (\w+)/) do |m|
16
- "<span>#{m}</span>"
17
- end
18
- f.should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
19
- end
20
-
21
- it "should format groups with proc object" do
22
- proc = lambda do |m|
23
- "<span>#{m}</span>"
24
- end
25
- f = "I ate 1 egg this morning".gzub(/I (\w+) (\d+) (\w+) this (\w+)/, proc)
26
- f.should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
27
- end
28
-
29
- it "should format groups with block with not all placeholders having a value" do
30
- f = "another member named Bob joins the group".gzub(/(a|another) (user|member) named ([^ ]+)( who is not logged in)?/) do |m|
31
- "<span>#{m}</span>"
32
- end
33
- f.should == "<span>another</span> <span>member</span> named <span>Bob</span> joins the group"
34
- end
35
-
36
- it "should format match groups in a textile table row" do
37
- f = "I ate 1 egg this morning".gzub(/I (\w+) (\d+) (\w+) this (\w+)/) do |m|
38
- "<span>#{m}</span>"
39
- end
40
- f.should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
41
- end
42
- end
@@ -1,35 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'cucumber/formatter/ansicolor'
3
-
4
- module Cucumber
5
- module Formatter
6
- describe ANSIColor do
7
- include ANSIColor
8
-
9
- after do
10
- ::Term::ANSIColor.coloring = true
11
- end
12
-
13
- it "should wrap passed_param with bold green and reset to green" do
14
- passed_param("foo").should == "\e[32m\e[1mfoo\e[0m\e[0m\e[32m"
15
- end
16
-
17
- it "should wrap passed in green" do
18
- passed("foo").should == "\e[32mfoo\e[0m"
19
- end
20
-
21
- it "should not reset passed if there are no arguments" do
22
- passed.should == "\e[32m"
23
- end
24
-
25
- it "should wrap comments in grey" do
26
- comment("foo").should == "\e[90mfoo\e[0m"
27
- end
28
-
29
- it "should not generate ansi codes when colors are disabled" do
30
- ::Term::ANSIColor.coloring = false
31
- passed("foo").should == "foo"
32
- end
33
- end
34
- end
35
- end
@@ -1,37 +0,0 @@
1
- body {
2
- background: #000000;
3
- color: #FFFFFF;
4
- }
5
-
6
- table {
7
- border-collapse: collapse;
8
- border-spacing: 10px;
9
- }
10
-
11
- td
12
- {
13
- border-color: #FFFFFF;
14
- border-width: 0 0.15em 0 0.15em;
15
- border-style: solid;
16
- padding: 0 0.5em 0 0.5em;
17
- }
18
-
19
- .multiline_table {
20
- padding-left: 4em;
21
- }
22
-
23
- .missing {
24
- color: yellow;
25
- }
26
-
27
- .pending {
28
- color: yellow;
29
- }
30
-
31
- .passed {
32
- color: green;
33
- }
34
-
35
- .failed {
36
- color: red;
37
- }
@@ -1,11 +0,0 @@
1
- jQuery.fn.status = function(s) {
2
- this.removeClass('idle').addClass(s);
3
- this.next('span.multiline').addClass(s);
4
- this.parent().addClass(s);
5
- this.parent().parent().children('span.feature').addClass(s);
6
- }
7
-
8
- jQuery.fn.failed = function(message, backtrace) {
9
- this.status('failed');
10
- this.append("\n<span>" + message.replace(/^/gm, ' ') + "</span>").append("\n<span>" + backtrace.replace(/^/gm, ' ') + "</span>");
11
- }
@@ -1,45 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Cucumber results</title>
8
- <link rel="stylesheet" href="cucumber.css" type="text/css" charset="utf-8" />
9
- <script type="text/javascript" src="jquery-1.3.min.js"></script>
10
- <script type="text/javascript" src="jquery.uitableedit.js"></script>
11
- <script type="text/javascript" src="cucumber.js"></script>
12
- </head>
13
-
14
- <body>
15
- <pre>
16
- <span><span class="feature">Feature: Sample</span>
17
-
18
- <span class="scenario"> Scenario: Missing
19
- <span id="step_1"> Given missing</span></span>
20
-
21
- <span class="scenario"> Scenario: Passing
22
- <span id="step_2"> Given passing</span><div class="multiline_table"><table>
23
- <tr>
24
- <td class="passed">1</td>
25
- <td class="passed">22</td>
26
- </tr>
27
- <tr>
28
- <td class="failed">4444</td>
29
- <td class="failed">333</td>
30
- </tr>
31
- </table></div></span>
32
- <span class="scenario"> Scenario: Failing
33
- <span id="step_3"> Given failing</span>
34
- <span class="multiline"> """
35
- Aslak
36
- Hellesøy
37
- """</span></span></span>
38
- </pre>
39
-
40
- <script type="text/javascript">$('#step_1').failed('error message', "line1\nline2\nline3")</script>
41
- <script type="text/javascript">$('#step_2').status('pending')</script>
42
- <script type="text/javascript">$('#step_3').status('passed')</script>
43
-
44
- </body>
45
- </html>