cucumber 0.4.4 → 0.4.5.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.gitignore +2 -1
  2. data/Caliper.yml +5 -0
  3. data/History.txt +24 -1
  4. data/Rakefile +1 -1
  5. data/VERSION.yml +2 -2
  6. data/cucumber.gemspec +18 -27
  7. data/cucumber.yml +10 -4
  8. data/examples/i18n/README.textile +1 -1
  9. data/examples/i18n/bg/features/consecutive_calculations.feature +1 -1
  10. data/examples/i18n/bg/features/division.feature +1 -1
  11. data/examples/i18n/en-lol/Rakefile +1 -3
  12. data/examples/i18n/en/features/division.feature +4 -4
  13. data/examples/i18n/et/features/jagamine.feature +1 -1
  14. data/examples/i18n/fr/features/addition2.feature +17 -0
  15. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +13 -0
  16. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +3 -3
  17. data/examples/i18n/lt/features/addition.feature +2 -2
  18. data/examples/i18n/lt/features/division.feature +1 -1
  19. data/examples/i18n/zh-CN/Rakefile +1 -3
  20. data/examples/i18n/zh-TW/Rakefile +1 -3
  21. data/examples/tcl/README.textile +11 -0
  22. data/examples/tcl/Rakefile +6 -0
  23. data/examples/tcl/features/fibonnacci.feature +17 -0
  24. data/examples/tcl/features/step_definitions/fib_steps.rb +7 -0
  25. data/examples/tcl/features/support/env.rb +6 -0
  26. data/examples/tcl/src/fib.tcl +3 -0
  27. data/examples/tickets/features/177/1.feature +3 -4
  28. data/examples/tickets/features/177/2.feature +2 -3
  29. data/examples/tickets/features/241.feature +2 -3
  30. data/examples/tickets/features/301/filter_background_tagged_hooks.feature +1 -1
  31. data/features/cucumber_cli.feature +4 -2
  32. data/features/custom_formatter.feature +32 -31
  33. data/features/html_formatter/a.html +319 -102
  34. data/features/language_help.feature +12 -14
  35. data/features/support/env.rb +1 -1
  36. data/features/transform.feature +17 -3
  37. data/gem_tasks/features.rake +3 -1
  38. data/lib/cucumber/ast/scenario_outline.rb +1 -1
  39. data/lib/cucumber/ast/step_invocation.rb +2 -2
  40. data/lib/cucumber/cli/configuration.rb +2 -17
  41. data/lib/cucumber/cli/language_help_formatter.rb +1 -1
  42. data/lib/cucumber/cli/options.rb +5 -4
  43. data/lib/cucumber/formatter/cucumber.css +198 -82
  44. data/lib/cucumber/formatter/cucumber.sass +173 -71
  45. data/lib/cucumber/formatter/html.rb +371 -195
  46. data/lib/cucumber/formatter/io.rb +33 -0
  47. data/lib/cucumber/formatter/junit.rb +16 -7
  48. data/lib/cucumber/formatter/pdf.rb +5 -5
  49. data/lib/cucumber/formatter/pretty.rb +6 -8
  50. data/lib/cucumber/formatter/progress.rb +4 -2
  51. data/lib/cucumber/formatter/rerun.rb +4 -2
  52. data/lib/cucumber/formatter/steps.rb +2 -2
  53. data/lib/cucumber/formatter/tag_cloud.rb +6 -2
  54. data/lib/cucumber/formatter/usage.rb +2 -2
  55. data/lib/cucumber/languages.yml +205 -281
  56. data/lib/cucumber/parser/feature.rb +348 -82
  57. data/lib/cucumber/parser/feature.tt +47 -11
  58. data/lib/cucumber/parser/i18n.tt +7 -17
  59. data/lib/cucumber/parser/natural_language.rb +45 -18
  60. data/lib/cucumber/rb_support/rb_transform.rb +1 -1
  61. data/lib/cucumber/step_mother.rb +2 -3
  62. data/lib/cucumber/webrat/element_locator.rb +9 -5
  63. data/spec/cucumber/cli/options_spec.rb +0 -3
  64. data/spec/cucumber/formatter/html_spec.rb +15 -2
  65. data/spec/cucumber/formatter/junit_spec.rb +3 -0
  66. data/spec/cucumber/treetop_parser/fit_scenario.feature +2 -2
  67. data/spec/cucumber/treetop_parser/given_scenario.feature +1 -1
  68. data/spec/cucumber/treetop_parser/multiple_tables.feature +2 -2
  69. data/spec/cucumber/treetop_parser/test_dos.feature +1 -1
  70. metadata +17 -26
  71. data/Manifest.txt +0 -0
  72. data/lib/cucumber/rails/action_controller.rb +0 -38
  73. data/lib/cucumber/rails/active_record.rb +0 -30
  74. data/lib/cucumber/rails/rspec.rb +0 -10
  75. data/lib/cucumber/rails/test_unit.rb +0 -9
  76. data/lib/cucumber/rails/world.rb +0 -30
  77. data/rails_generators/cucumber/USAGE +0 -11
  78. data/rails_generators/cucumber/cucumber_generator.rb +0 -117
  79. data/rails_generators/cucumber/templates/cucumber +0 -17
  80. data/rails_generators/cucumber/templates/cucumber.rake +0 -46
  81. data/rails_generators/cucumber/templates/cucumber_environment.rb +0 -30
  82. data/rails_generators/cucumber/templates/env.rb +0 -49
  83. data/rails_generators/cucumber/templates/paths.rb +0 -27
  84. data/rails_generators/cucumber/templates/spork_env.rb +0 -57
  85. data/rails_generators/cucumber/templates/version_check.rb +0 -31
  86. data/rails_generators/cucumber/templates/webrat_steps.rb +0 -241
  87. data/rails_generators/feature/USAGE +0 -12
  88. data/rails_generators/feature/feature_generator.rb +0 -40
  89. data/rails_generators/feature/templates/feature.erb +0 -31
  90. data/rails_generators/feature/templates/steps.erb +0 -14
@@ -1,31 +0,0 @@
1
- require 'cucumber/formatter/ansicolor'
2
- extend Cucumber::Formatter::ANSIColor
3
- if Cucumber::VERSION != '<%= Cucumber::VERSION %>'
4
- warning = <<-WARNING
5
- #{red_cukes(15)}
6
-
7
- #{red_cukes(1)} R O T T E N C U C U M B E R A L E R T #{red_cukes(1)}
8
-
9
- Your #{__FILE__.gsub(/version_check.rb$/, 'env.rb')} file was generated with Cucumber <%= Cucumber::VERSION %>,
10
- but you seem to be running Cucumber #{Cucumber::VERSION}. If you're running an older
11
- version than #{Cucumber::VERSION}, just upgrade your gem. If you're running a newer
12
- version than #{Cucumber::VERSION} you should:
13
-
14
- 1) Read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
15
-
16
- 2) Regenerate your cucumber environment with the following command:
17
-
18
- ruby script/generate cucumber
19
-
20
- If you get prompted to replace a file, hit 'd' to see the difference.
21
- When you're sure you have captured any personal edits, confirm that you
22
- want to overwrite #{__FILE__.gsub(/version_check.rb$/, 'env.rb')} by pressing 'y'. Then reapply any
23
- personal changes that may have been overwritten, preferably in separate files.
24
-
25
- This message will then self destruct.
26
-
27
- #{red_cukes(15)}
28
- WARNING
29
- warn(warning)
30
- at_exit {warn(warning)}
31
- end
@@ -1,241 +0,0 @@
1
- # IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION %>
2
- # Edit at your own peril - it's recommended to regenerate this file
3
- # in the future when you upgrade to a newer version of Cucumber.
4
- # Consider adding your own code to a new file instead of editing this one.
5
-
6
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
7
-
8
- # Commonly used webrat steps
9
- # http://github.com/brynary/webrat
10
-
11
- Given /^(?:|I )am on (.+)$/ do |page_name|
12
- visit path_to(page_name)
13
- end
14
-
15
- When /^(?:|I )go to (.+)$/ do |page_name|
16
- visit path_to(page_name)
17
- end
18
-
19
- When /^(?:|I )press "([^\"]*)"$/ do |button|
20
- click_button(button)
21
- end
22
-
23
- When /^(?:|I )follow "([^\"]*)"$/ do |link|
24
- click_link(link)
25
- end
26
-
27
- When /^(?:|I )follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
28
- click_link_within(parent, link)
29
- end
30
-
31
- When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
32
- fill_in(field, :with => value)
33
- end
34
-
35
- When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
36
- fill_in(field, :with => value)
37
- end
38
-
39
- # Use this to fill in an entire form with data from a table. Example:
40
- #
41
- # When I fill in the following:
42
- # | Account Number | 5002 |
43
- # | Expiry date | 2009-11-01 |
44
- # | Note | Nice guy |
45
- # | Wants Email? | |
46
- #
47
- # TODO: Add support for checkbox, select og option
48
- # based on naming conventions.
49
- #
50
- When /^(?:|I )fill in the following:$/ do |fields|
51
- fields.rows_hash.each do |name, value|
52
- When %{I fill in "#{name}" with "#{value}"}
53
- end
54
- end
55
-
56
- When /^(?:|I )select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
57
- select(value, :from => field)
58
- end
59
-
60
- # Use this step in conjunction with Rail's datetime_select helper. For example:
61
- # When I select "December 25, 2008 10:00" as the date and time
62
- When /^(?:|I )select "([^\"]*)" as the date and time$/ do |time|
63
- select_datetime(time)
64
- end
65
-
66
- # Use this step when using multiple datetime_select helpers on a page or
67
- # you want to specify which datetime to select. Given the following view:
68
- # <%%= f.label :preferred %><br />
69
- # <%%= f.datetime_select :preferred %>
70
- # <%%= f.label :alternative %><br />
71
- # <%%= f.datetime_select :alternative %>
72
- # The following steps would fill out the form:
73
- # When I select "November 23, 2004 11:20" as the "Preferred" date and time
74
- # And I select "November 25, 2004 10:30" as the "Alternative" date and time
75
- When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
76
- select_datetime(datetime, :from => datetime_label)
77
- end
78
-
79
- # Use this step in conjunction with Rail's time_select helper. For example:
80
- # When I select "2:20PM" as the time
81
- # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
82
- # will convert the 2:20PM to 14:20 and then select it.
83
- When /^(?:|I )select "([^\"]*)" as the time$/ do |time|
84
- select_time(time)
85
- end
86
-
87
- # Use this step when using multiple time_select helpers on a page or you want to
88
- # specify the name of the time on the form. For example:
89
- # When I select "7:30AM" as the "Gym" time
90
- When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
91
- select_time(time, :from => time_label)
92
- end
93
-
94
- # Use this step in conjunction with Rail's date_select helper. For example:
95
- # When I select "February 20, 1981" as the date
96
- When /^(?:|I )select "([^\"]*)" as the date$/ do |date|
97
- select_date(date)
98
- end
99
-
100
- # Use this step when using multiple date_select helpers on one page or
101
- # you want to specify the name of the date on the form. For example:
102
- # When I select "April 26, 1982" as the "Date of Birth" date
103
- When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
104
- select_date(date, :from => date_label)
105
- end
106
-
107
- When /^(?:|I )check "([^\"]*)"$/ do |field|
108
- check(field)
109
- end
110
-
111
- When /^(?:|I )uncheck "([^\"]*)"$/ do |field|
112
- uncheck(field)
113
- end
114
-
115
- When /^(?:|I )choose "([^\"]*)"$/ do |field|
116
- choose(field)
117
- end
118
-
119
- When /^(?:|I )attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
120
- attach_file(field, path)
121
- end
122
-
123
- Then /^(?:|I )should see "([^\"]*)"$/ do |text|
124
- <% if framework == :rspec -%>
125
- response.should contain(text)
126
- <% else -%>
127
- assert_contain text
128
- <% end -%>
129
- end
130
-
131
- Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
132
- within(selector) do |content|
133
- <% if framework == :rspec -%>
134
- content.should contain(text)
135
- <% else -%>
136
- assert content.include?(text)
137
- <% end -%>
138
- end
139
- end
140
-
141
- Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
142
- regexp = Regexp.new(regexp)
143
- <% if framework == :rspec -%>
144
- response.should contain(regexp)
145
- <% else -%>
146
- assert_contain regexp
147
- <% end -%>
148
- end
149
-
150
- Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
151
- within(selector) do |content|
152
- regexp = Regexp.new(regexp)
153
- <% if framework == :rspec -%>
154
- content.should contain(regexp)
155
- <% else -%>
156
- assert content =~ regexp
157
- <% end -%>
158
- end
159
- end
160
-
161
- Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
162
- <% if framework == :rspec -%>
163
- response.should_not contain(text)
164
- <% else -%>
165
- assert_not_contain text
166
- <% end -%>
167
- end
168
-
169
- Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
170
- within(selector) do |content|
171
- <% if framework == :rspec -%>
172
- content.should_not contain(text)
173
- <% else -%>
174
- assert !content.include?(text)
175
- <% end -%>
176
- end
177
- end
178
-
179
- Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
180
- regexp = Regexp.new(regexp)
181
- <% if framework == :rspec -%>
182
- response.should_not contain(regexp)
183
- <% else -%>
184
- assert_not_contain regexp
185
- <% end -%>
186
- end
187
-
188
- Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
189
- within(selector) do |content|
190
- regexp = Regexp.new(regexp)
191
- <% if framework == :rspec -%>
192
- content.should_not contain(regexp)
193
- <% else -%>
194
- assert content !~ regexp
195
- <% end -%>
196
- end
197
- end
198
-
199
- Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
200
- <% if framework == :rspec -%>
201
- field_labeled(field).value.should =~ /#{value}/
202
- <% else -%>
203
- assert_match(/#{value}/, field_labeled(field).value)
204
- <% end -%>
205
- end
206
-
207
- Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
208
- <% if framework == :rspec -%>
209
- field_labeled(field).value.should_not =~ /#{value}/
210
- <% else -%>
211
- assert_no_match(/#{value}/, field_labeled(field).value)
212
- <% end -%>
213
- end
214
-
215
- Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
216
- <% if framework == :rspec -%>
217
- field_labeled(label).should be_checked
218
- <% else -%>
219
- assert field_labeled(label).checked?
220
- <% end -%>
221
- end
222
-
223
- Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
224
- <% if framework == :rspec -%>
225
- field_labeled(label).should_not be_checked
226
- <% else -%>
227
- assert !field_labeled(label).checked?
228
- <% end -%>
229
- end
230
-
231
- Then /^(?:|I )should be on (.+)$/ do |page_name|
232
- <% if framework == :rspec -%>
233
- URI.parse(current_url).path.should == path_to(page_name)
234
- <% else -%>
235
- assert_equal path_to(page_name), URI.parse(current_url).path
236
- <% end -%>
237
- end
238
-
239
- Then /^show me the page$/ do
240
- save_and_open_page
241
- end
@@ -1,12 +0,0 @@
1
- Description:
2
- Generates a skeleton for a new feature. Both a simple .feature file and
3
- a steps.rb file is generated. This generator should be used with moderation.
4
- See http://github.com/aslakhellesoy/cucumber/wikis/feature-coupled-steps-antipattern
5
- for details about the dangers involved.
6
-
7
- This generator can take an optional list of attribute pairs similar to Rails'
8
- built-in resource generator.
9
-
10
- Examples:
11
- `./script/generate feature post` # no attributes
12
- `./script/generate feature post title:string body:text published:boolean`
@@ -1,40 +0,0 @@
1
- # This generator generates a baic feature.
2
- class FeatureGenerator < Rails::Generator::NamedBase
3
- def manifest
4
- record do |m|
5
- m.directory 'features/step_definitions'
6
- m.template 'feature.erb', "features/manage_#{plural_name}.feature"
7
- m.template 'steps.erb', "features/step_definitions/#{singular_name}_steps.rb"
8
-
9
- m.gsub_file 'features/support/paths.rb', /'\/'/mi do |match|
10
- "#{match}\n when /the new #{singular_name} page/\n new_#{singular_name}_path\n"
11
- end
12
- end
13
- end
14
-
15
- class NamedArg
16
- attr_reader :name
17
-
18
- def initialize(s)
19
- @name, @type = *s.split(':')
20
- end
21
-
22
- def value(n)
23
- if @type == 'boolean'
24
- (n % 2) == 0
25
- else
26
- "#{@name} #{n}"
27
- end
28
- end
29
- end
30
-
31
- def named_args
32
- args.map{|arg| NamedArg.new(arg)}
33
- end
34
-
35
- protected
36
-
37
- def banner
38
- "Usage: #{$0} feature ModelName [field:type, field:type]"
39
- end
40
- end
@@ -1,31 +0,0 @@
1
- Feature: Manage <%= plural_name %>
2
- In order to [goal]
3
- [stakeholder]
4
- wants [behaviour]
5
-
6
- Scenario: Register new <%= singular_name %>
7
- Given I am on the new <%= singular_name %> page
8
- <% keyword = 'When' -%>
9
- <% named_args.each do |arg| -%>
10
- <%= keyword %> I fill in "<%= arg.name.humanize %>" with "<%= arg.value(1) %>"
11
- <% keyword = 'And' -%>
12
- <% end -%>
13
- And I press "Create"
14
- <% keyword = 'Then' -%>
15
- <% named_args.each do |arg| -%>
16
- <%= keyword %> I should see "<%= arg.value(1) %>"
17
- <% keyword = 'And' -%>
18
- <% end -%>
19
-
20
- Scenario: Delete <%= singular_name %>
21
- Given the following <%= plural_name %>:
22
- |<%= named_args.map(&:name).join('|') %>|
23
- <% (1..4).each do |n| -%>
24
- |<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
25
- <% end -%>
26
- When I delete the 3rd <%= singular_name %>
27
- Then I should see the following <%= plural_name %>:
28
- |<%= named_args.map{|arg| arg.name.humanize}.join('|') %>|
29
- <% [1,2,4].each do |n| -%>
30
- |<%= named_args.map{|arg| arg.value(n)}.join('|') %>|
31
- <% end -%>
@@ -1,14 +0,0 @@
1
- Given /^the following <%= plural_name %>:$/ do |<%= plural_name %>|
2
- <%= class_name %>.create!(<%= plural_name %>.hashes)
3
- end
4
-
5
- When /^I delete the (\d+)(?:st|nd|rd|th) <%= singular_name %>$/ do |pos|
6
- visit <%= plural_name %>_url
7
- within("table > tr:nth-child(#{pos.to_i+1})") do
8
- click_link "Destroy"
9
- end
10
- end
11
-
12
- Then /^I should see the following <%= plural_name %>:$/ do |expected_<%= plural_name %>_table|
13
- expected_<%= plural_name %>_table.diff!(table_at('table').to_a)
14
- end