cucumber 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +152 -0
  4. data/README.txt +42 -0
  5. data/Rakefile +4 -0
  6. data/TODO.txt +26 -0
  7. data/bin/cucumber +4 -0
  8. data/config/hoe.rb +69 -0
  9. data/config/requirements.rb +15 -0
  10. data/cucumber.yml +1 -0
  11. data/examples/calculator/Rakefile +6 -0
  12. data/examples/calculator/cucumber.yml +1 -0
  13. data/examples/calculator/features/addition.feature +16 -0
  14. data/examples/calculator/features/division.feature +10 -0
  15. data/examples/calculator/features/steps/calculator_steps.rb +31 -0
  16. data/examples/calculator/lib/calculator.rb +16 -0
  17. data/examples/calculator_ruby_features/Rakefile +6 -0
  18. data/examples/calculator_ruby_features/features/addition.rb +23 -0
  19. data/examples/calculator_ruby_features/features/steps/calculator_steps.rb +43 -0
  20. data/examples/calculatrice_francaise_avec_soit_scenario/Rakefile +6 -0
  21. data/examples/calculatrice_francaise_avec_soit_scenario/features/addition.feature +13 -0
  22. data/examples/calculatrice_francaise_avec_soit_scenario/features/calculatrice_steps.rb +31 -0
  23. data/examples/cs/README.textile +22 -0
  24. data/examples/cs/Rakefile +12 -0
  25. data/examples/cs/features/hello.feature +11 -0
  26. data/examples/cs/features/steps/hello_steps.rb +25 -0
  27. data/examples/cs/features/steps/tree_steps.rb +14 -0
  28. data/examples/cs/features/tree.feature +9 -0
  29. data/examples/cs/src/Hello.cs +18 -0
  30. data/examples/danish_calculator/Rakefile +6 -0
  31. data/examples/danish_calculator/features/steps/kalkulator_steps.rb +22 -0
  32. data/examples/danish_calculator/features/summering.feature +17 -0
  33. data/examples/danish_calculator/lib/kalkulator.rb +11 -0
  34. data/examples/estonian_calculator/Rakefile +6 -0
  35. data/examples/estonian_calculator/features/kalkulaator_steps.rb +35 -0
  36. data/examples/estonian_calculator/features/liitmine.feature +16 -0
  37. data/examples/java/README.textile +22 -0
  38. data/examples/java/Rakefile +12 -0
  39. data/examples/java/features/hello.feature +11 -0
  40. data/examples/java/features/steps/hello_steps.rb +25 -0
  41. data/examples/java/features/steps/tree_steps.rb +14 -0
  42. data/examples/java/features/tree.feature +9 -0
  43. data/examples/java/src/cucumber/demo/Hello.java +16 -0
  44. data/examples/norwegian_calculator/Rakefile +6 -0
  45. data/examples/norwegian_calculator/features/steps/kalkulator_steps.rb +22 -0
  46. data/examples/norwegian_calculator/features/summering.feature +17 -0
  47. data/examples/norwegian_calculator/lib/kalkulator.rb +11 -0
  48. data/examples/portuguese_calculator/Rakefile +6 -0
  49. data/examples/portuguese_calculator/features/adicao.feature +10 -0
  50. data/examples/portuguese_calculator/features/calculadora_steps.rb +31 -0
  51. data/examples/selenium/Rakefile +6 -0
  52. data/examples/selenium/features/search.feature +9 -0
  53. data/examples/selenium/features/steps/stories_steps.rb +41 -0
  54. data/examples/spanish_calculator/Rakefile +6 -0
  55. data/examples/spanish_calculator/features/adicion.feature +17 -0
  56. data/examples/spanish_calculator/features/steps/calculador_steps.rb +22 -0
  57. data/examples/spanish_calculator/lib/Calculador.rb +11 -0
  58. data/examples/tickets/Rakefile +4 -0
  59. data/examples/tickets/features/steps/tickets_steps.rb +5 -0
  60. data/examples/tickets/features/tickets.feature +7 -0
  61. data/examples/watir/Rakefile +6 -0
  62. data/examples/watir/features/search.feature +9 -0
  63. data/examples/watir/features/steps/stories_steps.rb +51 -0
  64. data/features/see_features.feature +8 -0
  65. data/features/steps/features_steps.rb +9 -0
  66. data/gem_tasks/deployment.rake +34 -0
  67. data/gem_tasks/environment.rake +7 -0
  68. data/gem_tasks/features.rake +6 -0
  69. data/gem_tasks/fix_cr_lf.rake +10 -0
  70. data/gem_tasks/flog.rake +4 -0
  71. data/gem_tasks/gemspec.rake +6 -0
  72. data/gem_tasks/rspec.rake +21 -0
  73. data/gem_tasks/treetop.rake +27 -0
  74. data/generators/cucumber/cucumber_generator.rb +27 -0
  75. data/generators/cucumber/templates/common_webrat.rb +51 -0
  76. data/generators/cucumber/templates/cucumber +2 -0
  77. data/generators/cucumber/templates/cucumber.rake +7 -0
  78. data/generators/cucumber/templates/env.rb +8 -0
  79. data/generators/feature/feature_generator.rb +17 -0
  80. data/generators/feature/templates/feature.erb +27 -0
  81. data/generators/feature/templates/steps.erb +22 -0
  82. data/lib/cucumber.rb +32 -0
  83. data/lib/cucumber/cli.rb +163 -0
  84. data/lib/cucumber/core_ext/proc.rb +43 -0
  85. data/lib/cucumber/core_ext/string.rb +22 -0
  86. data/lib/cucumber/executor.rb +120 -0
  87. data/lib/cucumber/formatters.rb +1 -0
  88. data/lib/cucumber/formatters/ansicolor.rb +90 -0
  89. data/lib/cucumber/formatters/cucumber.css +132 -0
  90. data/lib/cucumber/formatters/cucumber.js +11 -0
  91. data/lib/cucumber/formatters/html_formatter.rb +125 -0
  92. data/lib/cucumber/formatters/jquery.js +32 -0
  93. data/lib/cucumber/formatters/pretty_formatter.rb +126 -0
  94. data/lib/cucumber/formatters/progress_formatter.rb +42 -0
  95. data/lib/cucumber/languages.yml +83 -0
  96. data/lib/cucumber/rails/rspec.rb +12 -0
  97. data/lib/cucumber/rails/world.rb +75 -0
  98. data/lib/cucumber/rake/task.rb +75 -0
  99. data/lib/cucumber/step_methods.rb +45 -0
  100. data/lib/cucumber/step_mother.rb +82 -0
  101. data/lib/cucumber/tree.rb +18 -0
  102. data/lib/cucumber/tree/feature.rb +53 -0
  103. data/lib/cucumber/tree/features.rb +21 -0
  104. data/lib/cucumber/tree/given_scenario.rb +13 -0
  105. data/lib/cucumber/tree/scenario.rb +110 -0
  106. data/lib/cucumber/tree/step.rb +123 -0
  107. data/lib/cucumber/tree/table.rb +26 -0
  108. data/lib/cucumber/tree/top_down_visitor.rb +23 -0
  109. data/lib/cucumber/treetop_parser/feature.treetop.erb +159 -0
  110. data/lib/cucumber/treetop_parser/feature_da.rb +1214 -0
  111. data/lib/cucumber/treetop_parser/feature_de.rb +1214 -0
  112. data/lib/cucumber/treetop_parser/feature_en.rb +1214 -0
  113. data/lib/cucumber/treetop_parser/feature_es.rb +1214 -0
  114. data/lib/cucumber/treetop_parser/feature_et.rb +1214 -0
  115. data/lib/cucumber/treetop_parser/feature_fr.rb +1214 -0
  116. data/lib/cucumber/treetop_parser/feature_no.rb +1214 -0
  117. data/lib/cucumber/treetop_parser/feature_parser.rb +32 -0
  118. data/lib/cucumber/treetop_parser/feature_pt.rb +1214 -0
  119. data/lib/cucumber/treetop_parser/feature_ru.rb +1214 -0
  120. data/lib/cucumber/treetop_parser/feature_se.rb +1214 -0
  121. data/lib/cucumber/version.rb +9 -0
  122. data/script/console +10 -0
  123. data/script/console.cmd +1 -0
  124. data/script/destroy +14 -0
  125. data/script/destroy.cmd +1 -0
  126. data/script/generate +14 -0
  127. data/script/generate.cmd +1 -0
  128. data/script/txt2html +74 -0
  129. data/script/txt2html.cmd +1 -0
  130. data/setup.rb +1585 -0
  131. data/spec/cucumber/cli_spec.rb +36 -0
  132. data/spec/cucumber/core_ext/proc_spec.rb +39 -0
  133. data/spec/cucumber/core_ext/string_spec.rb +34 -0
  134. data/spec/cucumber/executor_spec.rb +131 -0
  135. data/spec/cucumber/formatters/ansicolor_spec.rb +23 -0
  136. data/spec/cucumber/formatters/features.html +269 -0
  137. data/spec/cucumber/formatters/html_formatter_spec.rb +59 -0
  138. data/spec/cucumber/formatters/pretty_formatter_spec.rb +17 -0
  139. data/spec/cucumber/formatters/progress_formatter_spec.rb +44 -0
  140. data/spec/cucumber/sell_cucumbers.feature +9 -0
  141. data/spec/cucumber/step_mother_spec.rb +53 -0
  142. data/spec/cucumber/tree/scenario_spec.rb +15 -0
  143. data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
  144. data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
  145. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +73 -0
  146. data/spec/cucumber/treetop_parser/fit_scenario.feature +7 -0
  147. data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
  148. data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
  149. data/spec/cucumber/treetop_parser/spaces.feature +10 -0
  150. data/spec/cucumber/treetop_parser/with_comments.feature +6 -0
  151. data/spec/spec.opts +2 -0
  152. data/spec/spec_helper.rb +23 -0
  153. metadata +259 -0
@@ -0,0 +1,3 @@
1
+ == 0.1.6
2
+
3
+ First gem release!
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Aslak Hellesøy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,152 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ TODO.txt
7
+ bin/cucumber
8
+ config/hoe.rb
9
+ config/requirements.rb
10
+ cucumber.yml
11
+ examples/calculator/Rakefile
12
+ examples/calculator/cucumber.yml
13
+ examples/calculator/features/addition.feature
14
+ examples/calculator/features/division.feature
15
+ examples/calculator/features/steps/calculator_steps.rb
16
+ examples/calculator/lib/calculator.rb
17
+ examples/calculator_ruby_features/Rakefile
18
+ examples/calculator_ruby_features/features/addition.rb
19
+ examples/calculator_ruby_features/features/steps/calculator_steps.rb
20
+ examples/calculatrice_francaise_avec_soit_scenario/Rakefile
21
+ examples/calculatrice_francaise_avec_soit_scenario/features/addition.feature
22
+ examples/calculatrice_francaise_avec_soit_scenario/features/calculatrice_steps.rb
23
+ examples/cs/README.textile
24
+ examples/cs/Rakefile
25
+ examples/cs/features/hello.feature
26
+ examples/cs/features/steps/hello_steps.rb
27
+ examples/cs/features/steps/tree_steps.rb
28
+ examples/cs/features/tree.feature
29
+ examples/cs/src/Hello.cs
30
+ examples/danish_calculator/Rakefile
31
+ examples/danish_calculator/features/steps/kalkulator_steps.rb
32
+ examples/danish_calculator/features/summering.feature
33
+ examples/danish_calculator/lib/kalkulator.rb
34
+ examples/estonian_calculator/Rakefile
35
+ examples/estonian_calculator/features/kalkulaator_steps.rb
36
+ examples/estonian_calculator/features/liitmine.feature
37
+ examples/java/README.textile
38
+ examples/java/Rakefile
39
+ examples/java/features/hello.feature
40
+ examples/java/features/steps/hello_steps.rb
41
+ examples/java/features/steps/tree_steps.rb
42
+ examples/java/features/tree.feature
43
+ examples/java/src/cucumber/demo/Hello.java
44
+ examples/norwegian_calculator/Rakefile
45
+ examples/norwegian_calculator/features/steps/kalkulator_steps.rb
46
+ examples/norwegian_calculator/features/summering.feature
47
+ examples/norwegian_calculator/lib/kalkulator.rb
48
+ examples/portuguese_calculator/Rakefile
49
+ examples/portuguese_calculator/features/adicao.feature
50
+ examples/portuguese_calculator/features/calculadora_steps.rb
51
+ examples/selenium/Rakefile
52
+ examples/selenium/features/search.feature
53
+ examples/selenium/features/steps/stories_steps.rb
54
+ examples/spanish_calculator/Rakefile
55
+ examples/spanish_calculator/features/adicion.feature
56
+ examples/spanish_calculator/features/steps/calculador_steps.rb
57
+ examples/spanish_calculator/lib/Calculador.rb
58
+ examples/tickets/Rakefile
59
+ examples/tickets/features/steps/tickets_steps.rb
60
+ examples/tickets/features/tickets.feature
61
+ examples/watir/Rakefile
62
+ examples/watir/features/search.feature
63
+ examples/watir/features/steps/stories_steps.rb
64
+ features/see_features.feature
65
+ features/steps/features_steps.rb
66
+ gem_tasks/deployment.rake
67
+ gem_tasks/environment.rake
68
+ gem_tasks/features.rake
69
+ gem_tasks/fix_cr_lf.rake
70
+ gem_tasks/flog.rake
71
+ gem_tasks/gemspec.rake
72
+ gem_tasks/rspec.rake
73
+ gem_tasks/treetop.rake
74
+ generators/cucumber/cucumber_generator.rb
75
+ generators/cucumber/templates/common_webrat.rb
76
+ generators/cucumber/templates/cucumber
77
+ generators/cucumber/templates/cucumber.rake
78
+ generators/cucumber/templates/env.rb
79
+ generators/feature/feature_generator.rb
80
+ generators/feature/templates/feature.erb
81
+ generators/feature/templates/steps.erb
82
+ lib/cucumber.rb
83
+ lib/cucumber/cli.rb
84
+ lib/cucumber/core_ext/proc.rb
85
+ lib/cucumber/core_ext/string.rb
86
+ lib/cucumber/executor.rb
87
+ lib/cucumber/formatters.rb
88
+ lib/cucumber/formatters/ansicolor.rb
89
+ lib/cucumber/formatters/cucumber.css
90
+ lib/cucumber/formatters/cucumber.js
91
+ lib/cucumber/formatters/html_formatter.rb
92
+ lib/cucumber/formatters/jquery.js
93
+ lib/cucumber/formatters/pretty_formatter.rb
94
+ lib/cucumber/formatters/progress_formatter.rb
95
+ lib/cucumber/languages.yml
96
+ lib/cucumber/rails/rspec.rb
97
+ lib/cucumber/rails/world.rb
98
+ lib/cucumber/rake/task.rb
99
+ lib/cucumber/step_methods.rb
100
+ lib/cucumber/step_mother.rb
101
+ lib/cucumber/tree.rb
102
+ lib/cucumber/tree/feature.rb
103
+ lib/cucumber/tree/features.rb
104
+ lib/cucumber/tree/given_scenario.rb
105
+ lib/cucumber/tree/scenario.rb
106
+ lib/cucumber/tree/step.rb
107
+ lib/cucumber/tree/table.rb
108
+ lib/cucumber/tree/top_down_visitor.rb
109
+ lib/cucumber/treetop_parser/feature.treetop.erb
110
+ lib/cucumber/treetop_parser/feature_da.rb
111
+ lib/cucumber/treetop_parser/feature_de.rb
112
+ lib/cucumber/treetop_parser/feature_en.rb
113
+ lib/cucumber/treetop_parser/feature_es.rb
114
+ lib/cucumber/treetop_parser/feature_et.rb
115
+ lib/cucumber/treetop_parser/feature_fr.rb
116
+ lib/cucumber/treetop_parser/feature_no.rb
117
+ lib/cucumber/treetop_parser/feature_parser.rb
118
+ lib/cucumber/treetop_parser/feature_pt.rb
119
+ lib/cucumber/treetop_parser/feature_ru.rb
120
+ lib/cucumber/treetop_parser/feature_se.rb
121
+ lib/cucumber/version.rb
122
+ script/console
123
+ script/console.cmd
124
+ script/destroy
125
+ script/destroy.cmd
126
+ script/generate
127
+ script/generate.cmd
128
+ script/txt2html
129
+ script/txt2html.cmd
130
+ setup.rb
131
+ spec/cucumber/cli_spec.rb
132
+ spec/cucumber/core_ext/proc_spec.rb
133
+ spec/cucumber/core_ext/string_spec.rb
134
+ spec/cucumber/executor_spec.rb
135
+ spec/cucumber/formatters/ansicolor_spec.rb
136
+ spec/cucumber/formatters/features.html
137
+ spec/cucumber/formatters/html_formatter_spec.rb
138
+ spec/cucumber/formatters/pretty_formatter_spec.rb
139
+ spec/cucumber/formatters/progress_formatter_spec.rb
140
+ spec/cucumber/sell_cucumbers.feature
141
+ spec/cucumber/step_mother_spec.rb
142
+ spec/cucumber/tree/scenario_spec.rb
143
+ spec/cucumber/treetop_parser/empty_feature.feature
144
+ spec/cucumber/treetop_parser/empty_scenario.feature
145
+ spec/cucumber/treetop_parser/feature_parser_spec.rb
146
+ spec/cucumber/treetop_parser/fit_scenario.feature
147
+ spec/cucumber/treetop_parser/given_scenario.feature
148
+ spec/cucumber/treetop_parser/multiple_tables.feature
149
+ spec/cucumber/treetop_parser/spaces.feature
150
+ spec/cucumber/treetop_parser/with_comments.feature
151
+ spec/spec.opts
152
+ spec/spec_helper.rb
@@ -0,0 +1,42 @@
1
+ = Cucumber
2
+
3
+ * http://github.com/aslakhellesoy/cucumber
4
+
5
+ == DESCRIPTION:
6
+
7
+ Cucumber executes plain text documentation of code against that code.
8
+ Documentation: http://github.com/aslakhellesoy/cucumber/wikis/home
9
+
10
+ == REQUIREMENTS:
11
+
12
+ * FIX (list of requirements)
13
+
14
+ == INSTALL:
15
+
16
+ * gem sources --add http://gems.github.com/
17
+ * gem install aslakhellesoy-cucumber
18
+
19
+ == LICENSE:
20
+
21
+ (The MIT License)
22
+
23
+ Copyright (c) 2008 Aslak Hellesøy
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining
26
+ a copy of this software and associated documentation files (the
27
+ 'Software'), to deal in the Software without restriction, including
28
+ without limitation the rights to use, copy, modify, merge, publish,
29
+ distribute, sublicense, and/or sell copies of the Software, and to
30
+ permit persons to whom the Software is furnished to do so, subject to
31
+ the following conditions:
32
+
33
+ The above copyright notice and this permission notice shall be
34
+ included in all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
37
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
40
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['gem_tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,26 @@
1
+ == FEATURES/PROBLEMS:
2
+
3
+ * TODO: OK Refactor: Extract explicit node classes with RDoc (for better API doc)
4
+ * TODO: OK Get rid of the compile method. Compile the parser in Rake.
5
+ * TODO: OK Make grammar support \r\n, \r and \n (Add some fixture features for that)
6
+ * TODO: OK Make grammar support indentation
7
+ * TODO: OK Make grammar be totally relaxed about narrative
8
+ * TODO: OK Add a yaml file for different languages
9
+ * TODO: OK Custom nodes for the syntax tree
10
+ * TODO: OK Actually execute the features
11
+ * TODO: Make rake run specs by default
12
+ * TODO: OK Make it work with pure ruby regexen
13
+ * TODO: OK Make it work with string steps
14
+ * TODO: bin/cucumber --require [dir|file|glob]* --language no --format [file]*
15
+ * TODO: OK Pending steps shold print a block of code that can be pasted into code
16
+ * TODO: cucumber --where "Some text from a step" that prints "__FILE__:__LINE__ (STEP PATTERN)"
17
+ * TODO: Customisable trace output (like javascriptlint)
18
+ * TODO: Experiment: Make $variables become @variables
19
+ * TODO: OK GivenScenario
20
+ * TODO: OK PureRuby
21
+ * Make two trees include accept mixin
22
+ * TODO: Call steps from steps
23
+ * TODO: i18n in ruby too
24
+ * TODO: Don't load any treetop files if no .feature files are found
25
+ * TODO: Summary prints execution time
26
+ * TODO: --nocolor option
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib/') unless $:.include?(File.dirname(__FILE__) + '/../lib/')
3
+ require 'cucumber/cli'
4
+ Cucumber::CLI.execute
@@ -0,0 +1,69 @@
1
+ require 'cucumber/version'
2
+
3
+ AUTHOR = 'Aslak Hellesøy' # can also be an array of Authors
4
+ EMAIL = "aslak.hellesoy@gmail.com"
5
+ DESCRIPTION = "Executable Feature scenarios"
6
+ GEM_NAME = 'cucumber' # what ppl will type to install your gem
7
+ HOMEPATH = "http://github.com/aslakhellesoy/cucumber"
8
+ RUBYFORGE_PROJECT = 'rspec'
9
+
10
+ @config_file = "~/.rubyforge/user-config.yml"
11
+ @config = nil
12
+ RUBYFORGE_USERNAME = "aslak_hellesoy"
13
+ def rubyforge_username
14
+ unless @config
15
+ begin
16
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
17
+ rescue
18
+ puts <<-EOS
19
+ ERROR: No rubyforge config file found: #{@config_file}
20
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
21
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
22
+ EOS
23
+ exit
24
+ end
25
+ end
26
+ RUBYFORGE_USERNAME.replace @config["username"]
27
+ end
28
+
29
+
30
+ REV = nil
31
+ # UNCOMMENT IF REQUIRED:
32
+ # REV = YAML.load(`svn info`)['Revision']
33
+ VERS = Cucumber::VERSION::STRING + (REV ? ".#{REV}" : "")
34
+ RDOC_OPTS = ['--quiet', '--title', 'Cucumber documentation',
35
+ "--opname", "index.html",
36
+ "--line-numbers",
37
+ "--main", "README.textile",
38
+ "--inline-source"]
39
+
40
+ class Hoe
41
+ def extra_deps
42
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
43
+ @extra_deps
44
+ end
45
+ end
46
+
47
+ # Generate all the Rake tasks
48
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
49
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
50
+ p.developer(AUTHOR, EMAIL)
51
+ p.description = DESCRIPTION
52
+ p.summary = DESCRIPTION
53
+ p.url = HOMEPATH
54
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
55
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '**/*.class', '**/*.jar'] #An array of file patterns to delete on clean.
56
+
57
+ # == Optional
58
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
59
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
60
+ p.extra_deps = [ ['term-ansicolor', '>= 1.0.3'], ['treetop', '>= 1.2.4'], ['rspec', '>= 1.1.5'], ['diff-lcs', '>= 1.1.2'] ]
61
+
62
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
63
+
64
+ end
65
+
66
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
67
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
68
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
69
+ $hoe.rsync_args = '-av --delete --ignore-errors'
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -0,0 +1 @@
1
+ rest: --format progress features
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--profile default"
6
+ end
@@ -0,0 +1 @@
1
+ default: --format progress features
@@ -0,0 +1,16 @@
1
+ Feature: Addition
2
+ In order to avoid silly mistakes
3
+ As a math idiot
4
+ I want to be told the sum of two numbers
5
+
6
+ Scenario: Add two numbers
7
+ Given I have entered 50 into the calculator
8
+ And I have entered 70 into the calculator
9
+ When I press add
10
+ Then the result should be 120 on the screen
11
+ And the result class should be Fixnum
12
+
13
+ | input_1 | input_2 | button | output | class |
14
+ | 20 | 30 | add | 50 | Fixnum |
15
+ | 2 | 5 | add | 7 | Fixnum |
16
+ | 0 | 40 | add | 40 | Fixnum |
@@ -0,0 +1,10 @@
1
+ Feature: Division
2
+ In order to avoid silly mistakes
3
+ Cashiers must be able to calculate a fraction
4
+
5
+ Scenario: Regular numbers
6
+ Given I have entered 3 into the calculator
7
+ And I have entered 2 into the calculator
8
+ When I press divide
9
+ Then the result should be 1.5 on the screen
10
+ And the result class should be Float
@@ -0,0 +1,31 @@
1
+ require 'spec'
2
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
3
+ require 'calculator'
4
+
5
+ Before do
6
+ @calc = Calculator.new
7
+ end
8
+
9
+ After do
10
+ end
11
+
12
+ Given "I have entered $n into the calculator" do |n|
13
+ @calc.push n.to_i
14
+ end
15
+
16
+ When /I press (\w+)/ do |op|
17
+ @result = @calc.send op
18
+ end
19
+
20
+ Then /the result should be (.*) on the screen/ do |result|
21
+ @result.should == result.to_f
22
+ end
23
+
24
+ Then /the result class should be (\w*)/ do |class_name|
25
+ @result.class.name.should == class_name
26
+ end
27
+
28
+ Given /it should rain on (\w+)/ do |day|
29
+ @calc.rain?(day).should == true
30
+ end
31
+
@@ -0,0 +1,16 @@
1
+ class Calculator
2
+ def push(n)
3
+ n += 2 if n == 0 # a really stupid bug
4
+
5
+ @args ||= []
6
+ @args << n
7
+ end
8
+
9
+ def add
10
+ @args.inject(0){|n,sum| sum+=n}
11
+ end
12
+
13
+ def divide
14
+ @args[0].to_f / @args[1].to_f
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--format pretty"
6
+ end