kosmas58-cucumber 0.1.16.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. data/History.txt +389 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +270 -0
  4. data/README.txt +4 -0
  5. data/Rakefile +9 -0
  6. data/bin/cucumber +6 -0
  7. data/config/hoe.rb +70 -0
  8. data/config/requirements.rb +15 -0
  9. data/cucumber.yml +3 -0
  10. data/examples/calculator_ruby_features/Rakefile +6 -0
  11. data/examples/calculator_ruby_features/features/addition.rb +39 -0
  12. data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +43 -0
  13. data/examples/cs/README.textile +1 -0
  14. data/examples/cs/Rakefile +12 -0
  15. data/examples/cs/compile.bat +1 -0
  16. data/examples/cs/features/addition.feature +16 -0
  17. data/examples/cs/features/step_definitons/calculator_steps.rb +19 -0
  18. data/examples/cs/src/demo/Calculator.cs +20 -0
  19. data/examples/dos_line_endings/Rakefile +6 -0
  20. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  21. data/examples/i18n/README.textile +18 -0
  22. data/examples/i18n/Rakefile +32 -0
  23. data/examples/i18n/ar/Rakefile +6 -0
  24. data/examples/i18n/ar/features/addition.feature +17 -0
  25. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +33 -0
  26. data/examples/i18n/ar/lib/calculator.rb +10 -0
  27. data/examples/i18n/da/Rakefile +6 -0
  28. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +24 -0
  29. data/examples/i18n/da/features/summering.feature +17 -0
  30. data/examples/i18n/da/lib/kalkulator.rb +11 -0
  31. data/examples/i18n/de/Rakefile +6 -0
  32. data/examples/i18n/de/features/addition.feature +16 -0
  33. data/examples/i18n/de/features/division.feature +9 -0
  34. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +24 -0
  35. data/examples/i18n/de/lib/calculator.rb +14 -0
  36. data/examples/i18n/en/Rakefile +6 -0
  37. data/examples/i18n/en/features/addition.feature +16 -0
  38. data/examples/i18n/en/features/division.feature +9 -0
  39. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +24 -0
  40. data/examples/i18n/en/lib/calculator.rb +14 -0
  41. data/examples/i18n/es/Rakefile +6 -0
  42. data/examples/i18n/es/features/adicion.feature +17 -0
  43. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +24 -0
  44. data/examples/i18n/es/lib/calculador.rb +11 -0
  45. data/examples/i18n/et/Rakefile +6 -0
  46. data/examples/i18n/et/features/liitmine.feature +16 -0
  47. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +24 -0
  48. data/examples/i18n/et/lib/kalkulaator.rb +10 -0
  49. data/examples/i18n/fi/Rakefile +6 -0
  50. data/examples/i18n/fi/features/jakolasku.feature +9 -0
  51. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +24 -0
  52. data/examples/i18n/fi/features/yhteenlasku.feature +16 -0
  53. data/examples/i18n/fi/lib/laskin.rb +14 -0
  54. data/examples/i18n/fr/Rakefile +6 -0
  55. data/examples/i18n/fr/features/addition.feature +15 -0
  56. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +27 -0
  57. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  58. data/examples/i18n/id/Rakefile +6 -0
  59. data/examples/i18n/id/features/addition.feature +16 -0
  60. data/examples/i18n/id/features/division.feature +9 -0
  61. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +24 -0
  62. data/examples/i18n/id/lib/calculator.rb +14 -0
  63. data/examples/i18n/it/Rakefile +6 -0
  64. data/examples/i18n/it/features/somma.feature +10 -0
  65. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +24 -0
  66. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  67. data/examples/i18n/ja/README.txt +5 -0
  68. data/examples/i18n/ja/Rakefile +6 -0
  69. data/examples/i18n/ja/features/addition.feature +16 -0
  70. data/examples/i18n/ja/features/division.feature +9 -0
  71. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +25 -0
  72. data/examples/i18n/ja/lib/calculator.rb +14 -0
  73. data/examples/i18n/ko/Rakefile +6 -0
  74. data/examples/i18n/ko/features/addition.feature +16 -0
  75. data/examples/i18n/ko/features/division.feature +10 -0
  76. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +24 -0
  77. data/examples/i18n/ko/lib/calculator.rb +14 -0
  78. data/examples/i18n/lt/Rakefile +6 -0
  79. data/examples/i18n/lt/features/addition.feature +16 -0
  80. data/examples/i18n/lt/features/division.feature +9 -0
  81. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +24 -0
  82. data/examples/i18n/lt/lib/calculator.rb +14 -0
  83. data/examples/i18n/no/Rakefile +6 -0
  84. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +24 -0
  85. data/examples/i18n/no/features/summering.feature +17 -0
  86. data/examples/i18n/no/lib/kalkulator.rb +11 -0
  87. data/examples/i18n/pt/Rakefile +6 -0
  88. data/examples/i18n/pt/features/adicao.feature +10 -0
  89. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +24 -0
  90. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  91. data/examples/i18n/ro/Rakefile +6 -0
  92. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +24 -0
  93. data/examples/i18n/ro/features/suma.feature +10 -0
  94. data/examples/i18n/ro/lib/calculator.rb +11 -0
  95. data/examples/i18n/se/Rakefile +6 -0
  96. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +24 -0
  97. data/examples/i18n/se/features/summering.feature +17 -0
  98. data/examples/i18n/se/lib/kalkulator.rb +11 -0
  99. data/examples/i18n/zh-CN/Rakefile +6 -0
  100. data/examples/i18n/zh-CN/features/addition.feature +17 -0
  101. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +26 -0
  102. data/examples/i18n/zh-CN/lib/calculator.rb +10 -0
  103. data/examples/java/README.textile +22 -0
  104. data/examples/java/Rakefile +12 -0
  105. data/examples/java/features/hello.feature +11 -0
  106. data/examples/java/features/step_definitons/hello_steps.rb +25 -0
  107. data/examples/java/features/step_definitons/tree_steps.rb +14 -0
  108. data/examples/java/features/tree.feature +9 -0
  109. data/examples/selenium/Rakefile +6 -0
  110. data/examples/selenium/features/search.feature +9 -0
  111. data/examples/selenium/features/step_definitons/stories_steps.rb +40 -0
  112. data/examples/self_test/README.textile +3 -0
  113. data/examples/self_test/features/outline_sample.feature +9 -0
  114. data/examples/self_test/features/sample.feature +14 -0
  115. data/examples/self_test/features/step_definitions/sample_steps.rb +13 -0
  116. data/examples/test_unit/Rakefile +6 -0
  117. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
  118. data/examples/test_unit/features/test_unit.feature +9 -0
  119. data/examples/tickets/Rakefile +11 -0
  120. data/examples/tickets/cucumber.yml +2 -0
  121. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  122. data/examples/tickets/features/lib/pantry.rb +20 -0
  123. data/examples/tickets/features/scenario_outline.feature +90 -0
  124. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +42 -0
  125. data/examples/tickets/features/step_definitons/tickets_steps.rb +36 -0
  126. data/examples/tickets/features/tickets.feature +24 -0
  127. data/examples/watir/README.textile +16 -0
  128. data/examples/watir/Rakefile +6 -0
  129. data/examples/watir/features/search.feature +9 -0
  130. data/examples/watir/features/step_definitons/search_steps.rb +24 -0
  131. data/examples/watir/features/support/env.rb +32 -0
  132. data/features/cucumber_cli.feature +223 -0
  133. data/features/cucumber_cli_outlines.feature +73 -0
  134. data/features/step_definitions/cucumber_steps.rb +27 -0
  135. data/features/step_definitions/extra_steps.rb +2 -0
  136. data/features/support/env.rb +7 -0
  137. data/gem_tasks/deployment.rake +11 -0
  138. data/gem_tasks/environment.rake +7 -0
  139. data/gem_tasks/features.rake +9 -0
  140. data/gem_tasks/fix_cr_lf.rake +10 -0
  141. data/gem_tasks/flog.rake +4 -0
  142. data/gem_tasks/gemspec.rake +10 -0
  143. data/gem_tasks/rspec.rake +38 -0
  144. data/gem_tasks/treetop.rake +41 -0
  145. data/gem_tasks/yard.rake +8 -0
  146. data/lib/autotest/cucumber.rb +6 -0
  147. data/lib/autotest/cucumber_mixin.rb +130 -0
  148. data/lib/autotest/cucumber_rails.rb +6 -0
  149. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  150. data/lib/autotest/cucumber_rspec.rb +6 -0
  151. data/lib/autotest/discover.rb +9 -0
  152. data/lib/cucumber/broadcaster.rb +20 -0
  153. data/lib/cucumber/cli.rb +355 -0
  154. data/lib/cucumber/core_ext/exception.rb +20 -0
  155. data/lib/cucumber/core_ext/proc.rb +69 -0
  156. data/lib/cucumber/core_ext/string.rb +29 -0
  157. data/lib/cucumber/executor.rb +205 -0
  158. data/lib/cucumber/formatters/ansicolor.rb +105 -0
  159. data/lib/cucumber/formatters/autotest_formatter.rb +23 -0
  160. data/lib/cucumber/formatters/cucumber.css +132 -0
  161. data/lib/cucumber/formatters/cucumber.js +11 -0
  162. data/lib/cucumber/formatters/html_formatter.rb +152 -0
  163. data/lib/cucumber/formatters/jquery.js +32 -0
  164. data/lib/cucumber/formatters/pretty_formatter.rb +285 -0
  165. data/lib/cucumber/formatters/profile_formatter.rb +92 -0
  166. data/lib/cucumber/formatters/progress_formatter.rb +61 -0
  167. data/lib/cucumber/formatters/unicode.rb +35 -0
  168. data/lib/cucumber/formatters.rb +1 -0
  169. data/lib/cucumber/languages.yml +286 -0
  170. data/lib/cucumber/model/table.rb +32 -0
  171. data/lib/cucumber/model.rb +1 -0
  172. data/lib/cucumber/platform.rb +32 -0
  173. data/lib/cucumber/rails/rspec.rb +5 -0
  174. data/lib/cucumber/rails/world.rb +73 -0
  175. data/lib/cucumber/rake/task.rb +112 -0
  176. data/lib/cucumber/step_methods.rb +49 -0
  177. data/lib/cucumber/step_mother.rb +98 -0
  178. data/lib/cucumber/tree/feature.rb +105 -0
  179. data/lib/cucumber/tree/features.rb +21 -0
  180. data/lib/cucumber/tree/given_scenario.rb +13 -0
  181. data/lib/cucumber/tree/scenario.rb +240 -0
  182. data/lib/cucumber/tree/step.rb +173 -0
  183. data/lib/cucumber/tree/table.rb +26 -0
  184. data/lib/cucumber/tree/top_down_visitor.rb +23 -0
  185. data/lib/cucumber/tree.rb +16 -0
  186. data/lib/cucumber/treetop_parser/feature.treetop.erb +254 -0
  187. data/lib/cucumber/treetop_parser/feature_ar.rb +1951 -0
  188. data/lib/cucumber/treetop_parser/feature_cy.rb +1951 -0
  189. data/lib/cucumber/treetop_parser/feature_da.rb +1951 -0
  190. data/lib/cucumber/treetop_parser/feature_de.rb +1951 -0
  191. data/lib/cucumber/treetop_parser/feature_en-lol.rb +1951 -0
  192. data/lib/cucumber/treetop_parser/feature_en-tx.rb +1951 -0
  193. data/lib/cucumber/treetop_parser/feature_en.rb +1951 -0
  194. data/lib/cucumber/treetop_parser/feature_es.rb +1951 -0
  195. data/lib/cucumber/treetop_parser/feature_et.rb +1951 -0
  196. data/lib/cucumber/treetop_parser/feature_fi.rb +1951 -0
  197. data/lib/cucumber/treetop_parser/feature_fr.rb +1951 -0
  198. data/lib/cucumber/treetop_parser/feature_id.rb +1951 -0
  199. data/lib/cucumber/treetop_parser/feature_it.rb +1951 -0
  200. data/lib/cucumber/treetop_parser/feature_ja.rb +1951 -0
  201. data/lib/cucumber/treetop_parser/feature_ko.rb +1951 -0
  202. data/lib/cucumber/treetop_parser/feature_lt.rb +1951 -0
  203. data/lib/cucumber/treetop_parser/feature_nl.rb +1951 -0
  204. data/lib/cucumber/treetop_parser/feature_no.rb +1951 -0
  205. data/lib/cucumber/treetop_parser/feature_parser.rb +36 -0
  206. data/lib/cucumber/treetop_parser/feature_pl.rb +1951 -0
  207. data/lib/cucumber/treetop_parser/feature_pt.rb +1951 -0
  208. data/lib/cucumber/treetop_parser/feature_ro.rb +1951 -0
  209. data/lib/cucumber/treetop_parser/feature_ro2.rb +1951 -0
  210. data/lib/cucumber/treetop_parser/feature_ru.rb +1951 -0
  211. data/lib/cucumber/treetop_parser/feature_se.rb +1951 -0
  212. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1951 -0
  213. data/lib/cucumber/version.rb +10 -0
  214. data/lib/cucumber/world/pending.rb +22 -0
  215. data/lib/cucumber/world.rb +1 -0
  216. data/lib/cucumber.rb +19 -0
  217. data/rails_generators/cucumber/USAGE +11 -0
  218. data/rails_generators/cucumber/cucumber_generator.rb +31 -0
  219. data/rails_generators/cucumber/templates/cucumber +7 -0
  220. data/rails_generators/cucumber/templates/cucumber.rake +7 -0
  221. data/rails_generators/cucumber/templates/env.rb +16 -0
  222. data/rails_generators/cucumber/templates/paths.rb +12 -0
  223. data/rails_generators/cucumber/templates/webrat_steps.rb +99 -0
  224. data/rails_generators/feature/USAGE +12 -0
  225. data/rails_generators/feature/feature_generator.rb +36 -0
  226. data/rails_generators/feature/templates/feature.erb +31 -0
  227. data/rails_generators/feature/templates/steps.erb +24 -0
  228. data/setup.rb +1585 -0
  229. data/spec/cucumber/broadcaster_spec.rb +27 -0
  230. data/spec/cucumber/cli_spec.rb +521 -0
  231. data/spec/cucumber/core_ext/proc_spec.rb +45 -0
  232. data/spec/cucumber/core_ext/string_spec.rb +34 -0
  233. data/spec/cucumber/executor_spec.rb +382 -0
  234. data/spec/cucumber/formatters/ansicolor_spec.rb +35 -0
  235. data/spec/cucumber/formatters/autotest_formatter_spec.rb +26 -0
  236. data/spec/cucumber/formatters/features.html +269 -0
  237. data/spec/cucumber/formatters/html_formatter_spec.rb +110 -0
  238. data/spec/cucumber/formatters/pretty_formatter_spec.rb +410 -0
  239. data/spec/cucumber/formatters/profile_formatter_spec.rb +197 -0
  240. data/spec/cucumber/formatters/progress_formatter_spec.rb +81 -0
  241. data/spec/cucumber/model/table_spec.rb +32 -0
  242. data/spec/cucumber/rails/stubs/mini_rails.rb +18 -0
  243. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  244. data/spec/cucumber/rails/world_spec.rb +11 -0
  245. data/spec/cucumber/sell_cucumbers.feature +19 -0
  246. data/spec/cucumber/step_mother_spec.rb +74 -0
  247. data/spec/cucumber/tree/feature_spec.rb +122 -0
  248. data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
  249. data/spec/cucumber/tree/row_scenario_spec.rb +55 -0
  250. data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
  251. data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
  252. data/spec/cucumber/tree/scenario_spec.rb +134 -0
  253. data/spec/cucumber/tree/step_outline_spec.rb +17 -0
  254. data/spec/cucumber/tree/step_spec.rb +59 -0
  255. data/spec/cucumber/treetop_parser/empty_feature.feature +4 -0
  256. data/spec/cucumber/treetop_parser/empty_scenario.feature +9 -0
  257. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  258. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +120 -0
  259. data/spec/cucumber/treetop_parser/fit_scenario.feature +8 -0
  260. data/spec/cucumber/treetop_parser/given_scenario.feature +9 -0
  261. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  262. data/spec/cucumber/treetop_parser/multiline_steps.feature +17 -0
  263. data/spec/cucumber/treetop_parser/multiple_tables.feature +27 -0
  264. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  265. data/spec/cucumber/treetop_parser/spaces.feature +10 -0
  266. data/spec/cucumber/treetop_parser/test_dos.feature +25 -0
  267. data/spec/cucumber/treetop_parser/with_comments.feature +10 -0
  268. data/spec/cucumber/world/pending_spec.rb +46 -0
  269. data/spec/spec.opts +3 -0
  270. data/spec/spec_helper.rb +21 -0
  271. metadata +363 -0
@@ -0,0 +1,42 @@
1
+ Given /^there are (\d+) (\w+)$/ do |count, fruit|
2
+ @eattingMachine = EattingMachine.new(fruit, count)
3
+ end
4
+
5
+ Given "the belly space is < 12 and > 6" do
6
+ end
7
+
8
+ Given "I have the following fruits in my pantry" do |pantry_table|
9
+ @pantry = Pantry.new
10
+ pantry_table.hashes.each do |item|
11
+ @pantry.add(item['name'].downcase, item['quantity'])
12
+ end
13
+ end
14
+
15
+ Given "my shopping list" do |list|
16
+ @shopping_list = list
17
+ end
18
+
19
+ When /^I eat (\d+) (\w+)$/ do |count, fruit|
20
+ @eattingMachine.eat(count)
21
+ @eattingMachine.belly_count = count.to_i
22
+ end
23
+
24
+ When /^I eat (\d+) (\w+) from the pantry$/ do |count, fruit|
25
+ @pantry.remove(fruit, count.to_i)
26
+ end
27
+
28
+ Then /^I should have (\d+) (\w+)$/ do |count, fruit|
29
+ @eattingMachine.fruit_total.should == count.to_i
30
+ end
31
+
32
+ Then /^I should have (\d+) (\w+) in my belly$/ do |count, fruit|
33
+ @eattingMachine.belly_count.should == count.to_i
34
+ end
35
+
36
+ Then /^I should have (\d+) (\w+) in the pantry$/ do |count, fruit|
37
+ @pantry.count(fruit).should == count.to_i
38
+ end
39
+
40
+ Then /^my shopping list should equal$/ do |list|
41
+ @shopping_list.should == list
42
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec/expectations'
2
+
3
+ World do
4
+ Object.new
5
+ end
6
+
7
+ Given "be_empty" do
8
+ [1,2].should_not be_empty
9
+ end
10
+
11
+ Given "nested step is called" do
12
+ Given "nested step"
13
+ end
14
+
15
+ Given "nested step" do
16
+ @magic = 'mushroom'
17
+ end
18
+
19
+ Then "nested step should be executed" do
20
+ @magic.should == 'mushroom'
21
+ end
22
+
23
+ Given /^the following table$/ do |table|
24
+ @table = table
25
+ end
26
+
27
+ Then /^I should be (\w+) in (\w+)$/ do |key, value|
28
+ hash = @table.hashes[0]
29
+ hash[key].should == value
30
+ end
31
+
32
+ Then /^I shoule see a multiline string like$/ do |s|
33
+ s.should == %{A string
34
+ that spans
35
+ several lines}
36
+ end
@@ -0,0 +1,24 @@
1
+ Feature: Cucumber
2
+ In order to have a happy user base
3
+ As a Cucumber user
4
+ I don't want no stinkin bugs
5
+
6
+ Scenario: RSpec be_*
7
+ Given be_empty
8
+
9
+ Scenario: Call step from step
10
+ Given nested step is called
11
+ Then nested step should be executed
12
+
13
+ Scenario: Reading a table
14
+ Given the following table
15
+ | born | working |
16
+ | Oslo | London |
17
+ Then I should be working in London
18
+ And I should be born in Oslo
19
+ And I shoule see a multiline string like
20
+ """
21
+ A string
22
+ that spans
23
+ several lines
24
+ """
@@ -0,0 +1,16 @@
1
+ Here you'll find examples for Watir, FireWatir, SafariWatir and Celerity.
2
+ All of these browser libraries have the same API, so the example code will
3
+ work with all of them.
4
+
5
+ Just run with:
6
+
7
+ rake features
8
+
9
+ This will use Watir/IE if you're on Windows, and SafariWatir/Safari if you're on OS X.
10
+ You can force the use of FireWatir/Firefox on any platform like this:
11
+
12
+ rake features FIREWATIR=true
13
+
14
+ And finally, you can use Celerity by running in JRuby:
15
+
16
+ jruby -S rake 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 = "--format pretty"
6
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Search
2
+ In order to learn more
3
+ As an information seeker
4
+ I want to find more information
5
+
6
+ Scenario: Find what I'm looking for
7
+ Given I am on the Google search page
8
+ When I search for "cucumber github"
9
+ Then I should see a link to "Ruby on Rails — cucumber — GitHub":http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails
@@ -0,0 +1,24 @@
1
+ # Full Watir API: http://wtr.rubyforge.org/rdoc/
2
+ # Full RSpec API: http://rspec.rubyforge.org/
3
+
4
+ Given 'I am on the Google search page' do
5
+ @browser.goto 'http://www.google.com/'
6
+ end
7
+
8
+ When /I search for "(.*)"/ do |query|
9
+ @browser.text_field(:name, 'q').set(query)
10
+ @browser.button(:name, 'btnG').click
11
+ end
12
+
13
+ Then /I should see a link to "(.*)":(.*)/ do |text, url|
14
+ link = @browser.link(:url, url)
15
+ link.should_not == nil
16
+ link.text.should == text
17
+ end
18
+
19
+ # To avoid step definitions that are tightly coupled to your user interface,
20
+ # consider creating classes for your pages - such as this:
21
+ # http://github.com/aslakhellesoy/cucumber/tree/v0.1.15/examples/watir/features/step_definitons/search_steps.rb
22
+ #
23
+ # You may keep the page classes along your steps, or even better, put them in separate files, e.g.
24
+ # support/pages/google_search.rb
@@ -0,0 +1,32 @@
1
+ require 'spec/expectations'
2
+
3
+ if ENV['FIREWATIR']
4
+ require 'firewatir'
5
+ Browser = FireWatir::Firefox
6
+ else
7
+ case RUBY_PLATFORM
8
+ when /darwin/
9
+ require 'safariwatir'
10
+ Browser = Watir::Safari
11
+ when /win32|mingw/
12
+ require 'watir'
13
+ Browser = Watir::IE
14
+ when /java/
15
+ require 'celerity'
16
+ Browser = Celerity::Browser
17
+ else
18
+ raise "This platform is not supported (#{PLATFORM})"
19
+ end
20
+ end
21
+
22
+ # "before all"
23
+ browser = Browser.new
24
+
25
+ Before do
26
+ @browser = browser
27
+ end
28
+
29
+ # "after all"
30
+ at_exit do
31
+ browser.close
32
+ end
@@ -0,0 +1,223 @@
1
+ Feature: Cucumber command line
2
+ In order to write better software
3
+ Developers should be able to execute requirements as tests
4
+
5
+ Scenario: Run single scenario with missing step definition
6
+ When I run cucumber -q features/sample.feature:3
7
+ Then it should pass with
8
+ """
9
+ Feature: Sample
10
+ Scenario: Missing
11
+ Given missing
12
+
13
+
14
+ 1 scenario
15
+ 1 step pending (1 with no step definition)
16
+
17
+ """
18
+
19
+ Scenario: Run single failing scenario
20
+ When I run cucumber -q features/sample.feature:12
21
+ Then it should fail with
22
+ """
23
+ Feature: Sample
24
+ Scenario: Failing
25
+ Given failing
26
+ FAIL (RuntimeError)
27
+ ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
28
+ features/sample.feature:12:in `Given failing'
29
+
30
+
31
+ 1 scenario
32
+ 1 step failed
33
+
34
+ """
35
+
36
+ Scenario: Specify 2 line numbers
37
+ When I run cucumber -q features/sample.feature:3:12
38
+ Then it should fail with
39
+ """
40
+ Feature: Sample
41
+ Scenario: Missing
42
+ Given missing
43
+
44
+ Scenario: Failing
45
+ Given failing
46
+ FAIL (RuntimeError)
47
+ ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
48
+ features/sample.feature:12:in `Given failing'
49
+
50
+
51
+ 2 scenarios
52
+ 1 step failed
53
+ 1 step pending (1 with no step definition)
54
+
55
+ """
56
+
57
+
58
+ Scenario: Require missing step definition from elsewhere
59
+ When I run cucumber -q -r ../../features/step_definitions/extra_steps.rb features/sample.feature:3
60
+ Then it should pass with
61
+ """
62
+ Feature: Sample
63
+ Scenario: Missing
64
+ Given missing
65
+
66
+
67
+ 1 scenario
68
+ 1 step passed
69
+
70
+ """
71
+
72
+ Scenario: Specify the line number of a blank line
73
+ When I run cucumber -q features/sample.feature:10
74
+ Then it should pass with
75
+ """
76
+ Feature: Sample
77
+ Scenario: Passing
78
+ Given passing
79
+
80
+
81
+ 1 scenario
82
+ 1 step passed
83
+
84
+ """
85
+
86
+ Scenario: Specify the line number of a row
87
+ When I run cucumber -q features/sample.feature:8
88
+ Then it should pass with
89
+ """
90
+ Feature: Sample
91
+ Scenario: Passing
92
+ Given passing
93
+
94
+
95
+ 1 scenario
96
+ 1 step passed
97
+
98
+ """
99
+
100
+ Scenario: Run all with progress formatter
101
+ When I run cucumber -q --format progress features/sample.feature
102
+ Then it should fail with
103
+ """
104
+ P.F
105
+
106
+ Pending Scenarios:
107
+
108
+ 1) Sample (Missing)
109
+
110
+
111
+ Failed:
112
+
113
+ 1)
114
+ FAIL
115
+ ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
116
+ features/sample.feature:12:in `Given failing'
117
+
118
+ """
119
+
120
+ Scenario: Run Norwegian
121
+ Given I am in i18n/no
122
+ When I run cucumber -q --language no features
123
+ Then it should pass with
124
+ """
125
+ Egenskap: Summering
126
+ For å slippe å gjøre dumme feil
127
+ Som en regnskapsfører
128
+ Vil jeg kunne legge sammen
129
+ Scenario: to tall
130
+ Gitt at jeg har tastet inn 5
131
+ Og at jeg har tastet inn 7
132
+ Når jeg summerer
133
+ Så skal resultatet være 12
134
+
135
+ Scenario: tre tall
136
+ Gitt at jeg har tastet inn 5
137
+ Og at jeg har tastet inn 7
138
+ Og at jeg har tastet inn 1
139
+ Når jeg summerer
140
+ Så skal resultatet være 13
141
+
142
+
143
+ 2 scenarios
144
+ 9 steps passed
145
+
146
+ """
147
+
148
+ Scenario: --dry-run
149
+ When I run cucumber --dry-run features
150
+ Then it should pass with
151
+ """
152
+ Feature: Outline Sample # features/outline_sample.feature
153
+ Scenario Outline: Test state # features/outline_sample.feature:3
154
+ Given <state> without a table # features/outline_sample.feature:4
155
+
156
+ |state |
157
+ |missing|
158
+ |passing|
159
+ |failing|
160
+
161
+ Feature: Sample # features/sample.feature
162
+
163
+ Scenario: Missing # features/sample.feature:3
164
+ Given missing # other.rb:23
165
+
166
+ Scenario: Passing # features/sample.feature:6
167
+ Given passing # features/step_definitions/sample_steps.rb:1
168
+
169
+ Scenario: Failing # features/sample.feature:11
170
+ Given failing # features/step_definitions/sample_steps.rb:4
171
+
172
+
173
+ 7 scenarios
174
+ 6 steps passed
175
+
176
+ """
177
+
178
+ Scenario: Multiple formatters and outputs
179
+ When I run cucumber --format progress --out tmp/progress.txt --format html --out tmp/features.html features
180
+ Then it should fail with
181
+ """
182
+ """
183
+ And examples/self_test/tmp/progress.txt should contain
184
+ """
185
+ P.FP.F
186
+
187
+ Pending Scenarios:
188
+
189
+ 1) Outline Sample (Test state)
190
+ 2) Sample (Missing)
191
+
192
+
193
+ Failed:
194
+
195
+ 1)
196
+ FAIL
197
+ ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
198
+ features/outline_sample.feature:9:in `/^failing without a table$/'
199
+
200
+ 2)
201
+ FAIL
202
+ ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
203
+ features/sample.feature:12:in `Given failing'
204
+
205
+ """
206
+ And examples/self_test/tmp/features.html should match
207
+ """
208
+ Given passing
209
+ """
210
+
211
+ Scenario: Run scenario specified by name using --scenario
212
+ When I run cucumber --scenario Passing -q features/sample.feature
213
+ Then it should pass with
214
+ """
215
+ Feature: Sample
216
+ Scenario: Passing
217
+ Given passing
218
+
219
+
220
+ 1 scenario
221
+ 1 step passed
222
+
223
+ """
@@ -0,0 +1,73 @@
1
+ Feature: Cucumber command line
2
+ In order to write better software
3
+ Developers should be able to execute requirements as tests
4
+
5
+ Scenario: Run scenario outline steps only
6
+ When I run cucumber -q features/outline_sample.feature:3
7
+ Then it should pass with
8
+ """
9
+ Feature: Outline Sample
10
+ Scenario Outline: Test state
11
+ Given <state> without a table
12
+
13
+ |state |
14
+
15
+ 1 scenario
16
+
17
+ """
18
+
19
+ Scenario: Run single scenario outline table row with missing step definition
20
+ When I run cucumber -q features/outline_sample.feature:7
21
+ Then it should pass with
22
+ """
23
+ Feature: Outline Sample
24
+ Scenario Outline: Test state
25
+ Given <state> without a table
26
+
27
+ |state |
28
+ |missing|
29
+
30
+ 2 scenarios
31
+ 1 step pending (1 with no step definition)
32
+
33
+ """
34
+
35
+ Scenario: Run single failing scenario outline table row
36
+ When I run cucumber -q features/outline_sample.feature:9
37
+ Then it should fail with
38
+ """
39
+ Feature: Outline Sample
40
+ Scenario Outline: Test state
41
+ Given <state> without a table
42
+
43
+ |state |
44
+ |failing|
45
+
46
+ FAIL (RuntimeError)
47
+ ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
48
+ features/outline_sample.feature:9:in `/^failing without a table$/'
49
+
50
+ 2 scenarios
51
+ 1 step failed
52
+
53
+ """
54
+
55
+ Scenario: Run all with progress formatter
56
+ When I run cucumber -q --format progress features/outline_sample.feature
57
+ Then it should fail with
58
+ """
59
+ P.F
60
+
61
+ Pending Scenarios:
62
+
63
+ 1) Outline Sample (Test state)
64
+
65
+
66
+ Failed:
67
+
68
+ 1)
69
+ FAIL
70
+ ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
71
+ features/outline_sample.feature:9:in `/^failing without a table$/'
72
+
73
+ """
@@ -0,0 +1,27 @@
1
+ Given /^I am in (.*)$/ do |dir|
2
+ @dir = dir
3
+ end
4
+
5
+ When /^I run cucumber (.*)$/ do |cmd|
6
+ @dir ||= 'self_test'
7
+ full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/#{@dir}")
8
+ Dir.chdir(full_dir) do
9
+ @full_cmd = "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{cmd}"
10
+ @out = `#{@full_cmd}`
11
+ @status = $?.exitstatus
12
+ end
13
+ end
14
+
15
+ Then /^it should (fail|pass) with$/ do |success, output|
16
+ @out.should == output
17
+ code = success == 'fail' ? 1 : 0
18
+ @status.should == code
19
+ end
20
+
21
+ Then /^(.*) should contain$/ do |file, text|
22
+ IO.read(file).should == text
23
+ end
24
+
25
+ Then /^(.*) should match$/ do |file, text|
26
+ IO.read(file).should =~ Regexp.new(text)
27
+ end
@@ -0,0 +1,2 @@
1
+ Given /^missing$/ do
2
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec/expectations'
2
+ require 'fileutils'
3
+
4
+ Before do
5
+ FileUtils.rm_rf 'examples/self_test/tmp'
6
+ FileUtils.mkdir 'examples/self_test/tmp'
7
+ end
@@ -0,0 +1,11 @@
1
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
2
+ task :install_gem_no_doc => [:clean, :package] do
3
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
4
+ end
5
+
6
+ namespace :manifest do
7
+ desc 'Recreate Manifest.txt to include ALL files'
8
+ task :refresh do
9
+ `rake check_manifest | patch -p0 > Manifest.txt`
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,9 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ #t.language = "de"
6
+ #t.cucumber_opts = "--profile html --language #{t.language}"
7
+ t.cucumber_opts = "--profile html"
8
+ t.rcov = true
9
+ end
@@ -0,0 +1,10 @@
1
+ desc 'Make all files use UNIX (\n) line endings'
2
+ task :fix_cr_lf do
3
+ files = FileList['**/*']
4
+ files.each do |f|
5
+ next if File.directory?(f) || f =~ /dos/
6
+ s = IO.read(f)
7
+ s.gsub!(/\r?\n/, "\n")
8
+ File.open(f, "w") { |io| io.write(s) }
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ desc "Run flog over significant files"
2
+ task :flog do
3
+ sh "find lib -name \\*.rb | grep -v feature_..\\.rb | xargs flog"
4
+ end
@@ -0,0 +1,10 @@
1
+ namespace :gemspec do
2
+ desc 'Refresh cucumber.gemspec to include ALL files'
3
+ task :refresh => 'manifest:refresh' do
4
+ File.open('cucumber.gemspec', 'w') {|io| io.write($hoe.spec.to_ruby)}
5
+ puts "1) git commit -a -m \"Release #{Cucumber::VERSION::STRING}\""
6
+ puts "2) git tag -a \"v#{Cucumber::VERSION::STRING}\" -m \"Release #{Cucumber::VERSION::STRING}\""
7
+ puts "3) git push --tags"
8
+ puts "4) Bounce the version in version.rb"
9
+ end
10
+ end
@@ -0,0 +1,38 @@
1
+ def unable_to_load
2
+ STDERR.puts <<-EOS
3
+ To use rspec for testing you must install rspec gem:
4
+ gem install rspec
5
+
6
+ EOS
7
+ nil
8
+ end
9
+
10
+ def require_spec
11
+ require 'spec/expectations'
12
+ rescue LoadError
13
+ require_spec_with_rubygems
14
+ end
15
+
16
+ def require_spec_with_rubygems
17
+ require 'rubygems'
18
+ require 'spec/expectations'
19
+ rescue LoadError
20
+ unable_to_load
21
+ end
22
+
23
+ if require_spec
24
+ begin
25
+ require 'spec/rake/spectask'
26
+ rescue LoadError
27
+ unable_to_load
28
+ end
29
+
30
+ desc "Run the Cucumber specs"
31
+ Spec::Rake::SpecTask.new do |t|
32
+ t.spec_opts = ['--options', "spec/spec.opts"]
33
+ t.spec_files = FileList['spec/**/*_spec.rb']
34
+ t.fail_on_error = false
35
+ t.rcov = true
36
+ t.rcov_opts = ['--exclude', 'spec']
37
+ end
38
+ end
@@ -0,0 +1,41 @@
1
+ class FeatureCompiler
2
+ def initialize
3
+ require 'yaml'
4
+ require 'erb'
5
+
6
+ @tt = RUBY_PLATFORM =~ /mswin|mingw/ ? 'tt.bat' : 'tt'
7
+
8
+ @template = ERB.new(IO.read(File.dirname(__FILE__) + '/../lib/cucumber/treetop_parser/feature.treetop.erb'))
9
+ @langs = YAML.load_file(File.dirname(__FILE__) + '/../lib/cucumber/languages.yml')
10
+ end
11
+
12
+ def compile_all
13
+ @langs.keys.each do |lang|
14
+ compile(lang)
15
+ end
16
+ end
17
+
18
+ def compile(lang)
19
+ words = @langs['en'].merge(@langs[lang]) # Use English words if languages.yml is missing a word
20
+ grammar_file = File.dirname(__FILE__) + "/../lib/cucumber/treetop_parser/feature_#{lang}.treetop"
21
+ ruby_file = File.dirname(__FILE__) + "/../lib/cucumber/treetop_parser/feature_#{lang}.rb"
22
+ grammar = @template.result(binding)
23
+ File.open(grammar_file, "wb") do |io|
24
+ io.write(grammar)
25
+ end
26
+ sh "#{@tt} #{grammar_file}"
27
+ FileUtils.rm(grammar_file)
28
+ end
29
+ end
30
+
31
+ namespace :treetop do
32
+ desc 'Compile the grammar for all languages in languages.yml'
33
+ task :compile do
34
+ FeatureCompiler.new.compile_all
35
+ end
36
+
37
+ desc 'Compile the English grammar'
38
+ task :compile_en do
39
+ FeatureCompiler.new.compile('en')
40
+ end
41
+ end
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'yard'
3
+
4
+ YARD::Rake::YardocTask.new do |t|
5
+ t.files = ['lib/**/*.rb']
6
+ end
7
+ rescue LoadError => ignore
8
+ end