aslakhellesoy-cucumber 0.3.1.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,11 +1,18 @@
1
- == 0.3.2 (In Git)
1
+ == 0.3.2 2009-05-05
2
+
3
+ This release has some minor bug fixes and new features.
4
+ Nothing major, but we need a release for RailsConf'09 in Las Vegas!
2
5
 
3
6
  === Bugfixes
7
+ * rake tasks with profiles not respecting --require flags (#311 Ben Mabey)
4
8
  * Step table with blank cell fails (#308 JohnnyT)
9
+ * Fixed error where unused table cells in Examples where raising exceptions due to having no status (#302 Joseph Wilk)
5
10
 
6
11
  === New features
12
+ * Support for Hebrew (Ido Kanner)
7
13
  * Summary should report scenarios (#32 Aslak Hellesøy)
8
14
  * Examples and the associated tables are indented one level deeper than Scenario Outline. (Aslak Hellesøy)
15
+ * Added support for Examples selection when using --name. (#295 Joseph Wilk)
9
16
 
10
17
  == 0.3.1 2009-04-26
11
18
 
data/Manifest.txt CHANGED
@@ -67,6 +67,11 @@ examples/i18n/fr/Rakefile
67
67
  examples/i18n/fr/features/addition.feature
68
68
  examples/i18n/fr/features/step_definitions/calculatrice_steps.rb
69
69
  examples/i18n/fr/lib/calculatrice.rb
70
+ examples/i18n/he/Rakefile
71
+ examples/i18n/he/features/addition.feature
72
+ examples/i18n/he/features/division.feature
73
+ examples/i18n/he/features/step_definitons/calculator_steps.rb
74
+ examples/i18n/he/lib/calculator.rb
70
75
  examples/i18n/hu/Rakefile
71
76
  examples/i18n/hu/features/addition.feature
72
77
  examples/i18n/hu/features/division.feature
@@ -341,6 +346,7 @@ spec/cucumber/formatter/html/cucumber.js
341
346
  spec/cucumber/formatter/html/index.html
342
347
  spec/cucumber/formatter/html/jquery-1.3.min.js
343
348
  spec/cucumber/formatter/html/jquery.uitableedit.js
349
+ spec/cucumber/formatter/progress_spec.rb
344
350
  spec/cucumber/parser/feature_parser_spec.rb
345
351
  spec/cucumber/parser/table_parser_spec.rb
346
352
  spec/cucumber/rails/stubs/mini_rails.rb
@@ -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 = "--language he"
6
+ end
@@ -0,0 +1,16 @@
1
+ תכונה: חיבור
2
+ כדי למנוע טעויות טפשיות
3
+ בתור בור מתמטי
4
+ אני רוצה שיגידו לי את הסכום של שני מספרים
5
+
6
+ תבנית תרחיש: חבר שני מספרים
7
+ בהינתן שהזנתי <קלט_1> למחשבון
8
+ וגם שהזנתי <קלט_2> למחשבון
9
+ כאשר אני לוחץ על <כפתור>
10
+ אז התוצאה על המסך צריכה להיות <פלט>
11
+
12
+ דוגמאות:
13
+ | קלט_1 | קלט_2 | כפתור | פלט |
14
+ | 20 | 30 | חבר | 50 |
15
+ | 2 | 5 | חבר | 7 |
16
+ | 0 | 40 | חבר | 40 |
@@ -0,0 +1,9 @@
1
+ תכונה: חילוק
2
+ כדי למנוע טעויות טפשיות
3
+ לקופאים חייבת להיות יכולת לחשב שבר
4
+
5
+ תרחיש: מספרים רגילים
6
+ בהינתן שהזנתי 3 למחשבון
7
+ וגם שהזנתי 2 למחשבון
8
+ כאשר אני לוחץ על חלק
9
+ אז התוצאה על המסך צריכה להיות 1.5
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
4
+ require 'cucumber/formatter/unicode'
5
+ require 'calculator'
6
+
7
+ Before do
8
+ @calc = Calculator.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Given /שהזנתי (\d+) למחשבון/ do |n|
15
+ @calc.push n.to_i
16
+ end
17
+
18
+ When /אני לוחץ על (\w+)/ do |op|
19
+ @result = @calc.send op
20
+ end
21
+
22
+ Then /התוצאה על המסך צריכה להיות (.*)/ do |result|
23
+ @result.should == result.to_f
24
+ end
@@ -0,0 +1,14 @@
1
+ class Calculator
2
+ def push(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def חבר
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def חלק
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end
@@ -20,3 +20,13 @@ Feature: search examples
20
20
  Examples:
21
21
  |state|
22
22
  |passing|
23
+
24
+ Scenario Outline: no match in name but in examples
25
+ Given <state> without a table
26
+ Examples: Hantu Pisang
27
+ |state|
28
+ |passing|
29
+
30
+ Examples: Ignore me
31
+ |state|
32
+ |failing|
@@ -6,4 +6,7 @@ Feature: Search
6
6
  Scenario: Find what I'm looking for
7
7
  Given I am on the Google search page
8
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
9
+ Then I should see
10
+ """
11
+ BDD that talks to domain experts first and code second
12
+ """
@@ -10,10 +10,8 @@ When /I search for "(.*)"/ do |query|
10
10
  @browser.button(:name, 'btnG').click
11
11
  end
12
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
13
+ Then /I should see/ do |text|
14
+ @browser.text.should =~ /#{text}/m
17
15
  end
18
16
 
19
17
  # To avoid step definitions that are tightly coupled to your user interface,
@@ -281,6 +281,17 @@ Feature: Cucumber command line
281
281
  | state |
282
282
  | passing |
283
283
 
284
+ Scenario Outline: no match in name but in examples
285
+ Given <state> without a table
286
+
287
+ Examples: Hantu Pisang
288
+ | state |
289
+ | passing |
290
+
291
+ Examples: Ignore me
292
+ | state |
293
+ | failing |
294
+
284
295
  Feature: undefined multiline args
285
296
 
286
297
  Scenario: pystring
@@ -293,9 +304,9 @@ Feature: Cucumber command line
293
304
  Given a table
294
305
  | table |
295
306
  | example |
296
-
297
- 21 scenarios (15 skipped, 5 undefined, 1 passed)
298
- 35 steps (26 skipped, 9 undefined)
307
+
308
+ 23 scenarios (17 skipped, 5 undefined, 1 passed)
309
+ 39 steps (30 skipped, 9 undefined)
299
310
 
300
311
  """
301
312
 
@@ -344,8 +355,15 @@ Feature: Cucumber command line
344
355
  | state |
345
356
  | passing |
346
357
 
347
- 2 scenarios (2 passed)
348
- 4 steps (4 passed)
358
+ Scenario Outline: no match in name but in examples
359
+ Given <state> without a table
360
+
361
+ Examples: Hantu Pisang
362
+ | state |
363
+ | passing |
364
+
365
+ 3 scenarios (3 passed)
366
+ 6 steps (6 passed)
349
367
 
350
368
  """
351
369
 
@@ -123,3 +123,28 @@ Feature: Rake task
123
123
  """
124
124
  Cucumber::Rake::Task#feature_list is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
125
125
  """
126
+
127
+ Scenario: respect requires
128
+ Given a file named "features/support/env.rb"
129
+ And a file named "features/support/dont_require_me.rb"
130
+ And the following profile is defined:
131
+ """
132
+ no_bomb: features/missing_step_definitions.feature:3 --require features/support/env.rb --verbose
133
+ """
134
+ And a file named "Rakefile" with:
135
+ """
136
+ $LOAD_PATH.unshift(CUCUMBER_LIB)
137
+ require 'cucumber/rake/task'
138
+
139
+ Cucumber::Rake::Task.new(:features) do |t|
140
+ t.profile = "no_bomb"
141
+ t.cucumber_opts = "--quiet --no-color"
142
+ end
143
+ """
144
+
145
+ When I run rake features
146
+ Then it should pass
147
+ And the output should not contain
148
+ """
149
+ * features/support/dont_require_me.rb
150
+ """
@@ -10,6 +10,10 @@ Given /^a standard Cucumber project directory structure$/ do
10
10
  end
11
11
  end
12
12
 
13
+ Given /^a file named "([^\"]*)"$/ do |file_name|
14
+ create_file(file_name, '')
15
+ end
16
+
13
17
  Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
14
18
  create_file(file_name, file_content)
15
19
  end
@@ -43,6 +47,10 @@ Then /^the output should contain$/ do |text|
43
47
  last_stdout.should include(text)
44
48
  end
45
49
 
50
+ Then /^the output should not contain$/ do |text|
51
+ last_stdout.should_not include(text)
52
+ end
53
+
46
54
  Then /^"(.*)" should contain$/ do |file, text|
47
55
  IO.read(file).should == text
48
56
  end
@@ -18,6 +18,7 @@ Feature: Cucumber command line
18
18
  Given passing without a table # features/search_sample.feature:4
19
19
  Given passing without a table # features/search_sample.feature:7
20
20
  Given <state> without a table # features/search_sample.feature:19
21
+ Given <state> without a table # features/search_sample.feature:25
21
22
  /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
22
23
  Given failing without a table # features/background/failing_background.feature:5
23
24
  Given failing without a table # features/background/scenario_outline_failing_background.feature:4
@@ -18,18 +18,14 @@ module Cucumber
18
18
  print_summary
19
19
  end
20
20
 
21
- def visit_multiline_arg(multiline_arg)
22
- @multiline_arg = true
23
- super
24
- @multiline_arg = false
25
- end
26
-
27
- def visit_step_name(keyword, step_match, status, source_indent, background)
28
- progress(status) unless status == :outline
21
+ def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
22
+ progress(status)
23
+ @status = status
29
24
  end
30
25
 
31
26
  def visit_table_cell_value(value, width, status)
32
- progress(status) if (status != :thead) && !@multiline_arg
27
+ status ||= @status
28
+ progress(status) unless table_header_cell?(status)
33
29
  end
34
30
 
35
31
  private
@@ -55,6 +51,9 @@ module Cucumber
55
51
  @io.flush
56
52
  end
57
53
 
54
+ def table_header_cell?(status)
55
+ status == :skipped_param
56
+ end
58
57
  end
59
58
  end
60
59
  end
@@ -206,6 +206,21 @@
206
206
  and: Et
207
207
  but: Mais
208
208
  space_after_keyword: true
209
+ "he":
210
+ name: Hebrew
211
+ native: עברית
212
+ encoding: UTF-8
213
+ feature: תכונה
214
+ background: רקע
215
+ scenario: תרחיש
216
+ scenario_outline: תבנית תרחיש
217
+ examples: דוגמאות
218
+ given: בהינתן
219
+ when: כאשר
220
+ then: אז|אזי
221
+ and: וגם
222
+ but: אבל
223
+ space_after_keyword: true
209
224
  "hu":
210
225
  name: Hungarian
211
226
  native: magyar
@@ -482,4 +497,4 @@
482
497
  then: То
483
498
  and: И
484
499
  but: Но
485
- space_after_keyword: true
500
+ space_after_keyword: true
@@ -827,6 +827,10 @@ module Cucumber
827
827
  end
828
828
 
829
829
  def matches_name?(regexp_to_match)
830
+ outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
831
+ end
832
+
833
+ def outline_matches_name?(regexp_to_match)
830
834
  name.build =~ regexp_to_match
831
835
  end
832
836
 
@@ -1088,9 +1092,13 @@ module Cucumber
1088
1092
  elements.detect { |e| e.at_line?(line) }
1089
1093
  end
1090
1094
 
1095
+ def matches_name?(regexp_to_match)
1096
+ elements.detect { |e| e.matches_name?(regexp_to_match) }
1097
+ end
1098
+
1091
1099
  def build(filter, scenario_outline)
1092
1100
  elements.map do |e|
1093
- if(filter.nil? || filter.accept?(e) || filter.outline_at_line?(scenario_outline))
1101
+ if(filter.nil? || filter.accept_example?(e, scenario_outline))
1094
1102
  e.build(filter, scenario_outline)
1095
1103
  end
1096
1104
  end.compact
@@ -165,6 +165,10 @@ module Cucumber
165
165
  end
166
166
 
167
167
  def matches_name?(regexp_to_match)
168
+ outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
169
+ end
170
+
171
+ def outline_matches_name?(regexp_to_match)
168
172
  name.build =~ regexp_to_match
169
173
  end
170
174
 
@@ -218,9 +222,13 @@ module Cucumber
218
222
  elements.detect { |e| e.at_line?(line) }
219
223
  end
220
224
 
225
+ def matches_name?(regexp_to_match)
226
+ elements.detect { |e| e.matches_name?(regexp_to_match) }
227
+ end
228
+
221
229
  def build(filter, scenario_outline)
222
230
  elements.map do |e|
223
- if(filter.nil? || filter.accept?(e) || filter.outline_at_line?(scenario_outline))
231
+ if(filter.nil? || filter.accept_example?(e, scenario_outline))
224
232
  e.build(filter, scenario_outline)
225
233
  end
226
234
  end.compact
@@ -26,6 +26,11 @@ module Cucumber
26
26
  matches_names?(syntax_node)
27
27
  end
28
28
 
29
+ def accept_example?(syntax_node, outline)
30
+ (at_line?(syntax_node) || outline_at_line?(outline)) &&
31
+ (matches_names?(syntax_node) || outline_matches_names?(outline))
32
+ end
33
+
29
34
  def at_line?(syntax_node)
30
35
  @lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.at_line?(line)}
31
36
  end
@@ -47,6 +52,10 @@ module Cucumber
47
52
  @exclude_tags.any? && syntax_node.has_tags?(@exclude_tags)
48
53
  end
49
54
 
55
+ def outline_matches_names?(syntax_node)
56
+ @name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.outline_matches_name?(name_regexp)}
57
+ end
58
+
50
59
  def matches_names?(syntax_node)
51
60
  @name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.matches_name?(name_regexp)}
52
61
  end
@@ -62,6 +62,8 @@ module Cucumber
62
62
  def profile=(profile)
63
63
  @profile = profile
64
64
  unless feature_list
65
+ # TODO: remove once we completely remove these from the rake task.
66
+ @step_list = []
65
67
  @feature_list = [] # Don't use accessor to avoid deprecation warning.
66
68
  end
67
69
  end
@@ -2,8 +2,8 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 1
6
- PATCH = 1 # Set to nil for official release
5
+ TINY = 2
6
+ PATCH = nil # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ describe Progress do
6
+
7
+ before(:all) do
8
+ Term::ANSIColor.coloring = false
9
+ end
10
+
11
+ before(:each) do
12
+ @out = StringIO.new
13
+ @progress = Progress.new(mock("step mother"), @out, {})
14
+ end
15
+
16
+ describe "visiting a table cell value without a status" do
17
+ it "should take the status from the last run step" do
18
+ @progress.visit_step_result('', '', nil, :failed, nil, 10, nil)
19
+ @progress.visit_table_cell_value('value', 10, nil)
20
+
21
+ @out.string.should == "FF"
22
+ end
23
+ end
24
+
25
+ describe "visiting a table cell which is a table header" do
26
+ it "should not output anything" do
27
+ @progress.visit_table_cell_value('value', 10, :skipped_param)
28
+
29
+ @out.string.should == ""
30
+ end
31
+ end
32
+
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-28 00:00:00 -07:00
12
+ date: 2009-05-03 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -144,6 +144,11 @@ files:
144
144
  - examples/i18n/fr/features/addition.feature
145
145
  - examples/i18n/fr/features/step_definitions/calculatrice_steps.rb
146
146
  - examples/i18n/fr/lib/calculatrice.rb
147
+ - examples/i18n/he/Rakefile
148
+ - examples/i18n/he/features/addition.feature
149
+ - examples/i18n/he/features/division.feature
150
+ - examples/i18n/he/features/step_definitons/calculator_steps.rb
151
+ - examples/i18n/he/lib/calculator.rb
147
152
  - examples/i18n/hu/Rakefile
148
153
  - examples/i18n/hu/features/addition.feature
149
154
  - examples/i18n/hu/features/division.feature
@@ -418,6 +423,7 @@ files:
418
423
  - spec/cucumber/formatter/html/index.html
419
424
  - spec/cucumber/formatter/html/jquery-1.3.min.js
420
425
  - spec/cucumber/formatter/html/jquery.uitableedit.js
426
+ - spec/cucumber/formatter/progress_spec.rb
421
427
  - spec/cucumber/parser/feature_parser_spec.rb
422
428
  - spec/cucumber/parser/table_parser_spec.rb
423
429
  - spec/cucumber/rails/stubs/mini_rails.rb