aslakhellesoy-cucumber 0.3.5 → 0.3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/History.txt +24 -0
  2. data/Manifest.txt +5 -2
  3. data/examples/i18n/fr/features/addition.feature +4 -4
  4. data/features/after_block_exceptions.feature +97 -0
  5. data/features/after_step_block_exceptions.feature +99 -0
  6. data/features/background.feature +47 -2
  7. data/features/custom_formatter.feature +1 -1
  8. data/features/step_definitions/cucumber_steps.rb +8 -0
  9. data/features/work_in_progress.feature +146 -0
  10. data/lib/cucumber.rb +5 -0
  11. data/lib/cucumber/ast/background.rb +3 -3
  12. data/lib/cucumber/ast/outline_table.rb +51 -4
  13. data/lib/cucumber/ast/scenario.rb +9 -3
  14. data/lib/cucumber/ast/scenario_outline.rb +4 -0
  15. data/lib/cucumber/ast/step.rb +3 -3
  16. data/lib/cucumber/ast/step_invocation.rb +13 -4
  17. data/lib/cucumber/cli/configuration.rb +54 -23
  18. data/lib/cucumber/cli/main.rb +6 -2
  19. data/lib/cucumber/formatter/console.rb +9 -0
  20. data/lib/cucumber/formatter/junit.rb +1 -1
  21. data/lib/cucumber/formatter/pretty.rb +7 -2
  22. data/lib/cucumber/formatter/progress.rb +1 -0
  23. data/lib/cucumber/formatter/tag_cloud.rb +27 -0
  24. data/lib/cucumber/languages.yml +60 -60
  25. data/lib/cucumber/rails/world.rb +16 -3
  26. data/lib/cucumber/rake/task.rb +2 -2
  27. data/lib/cucumber/step_match.rb +3 -2
  28. data/lib/cucumber/step_mother.rb +29 -4
  29. data/lib/cucumber/version.rb +2 -2
  30. data/rails_generators/cucumber/templates/cucumber.rake +1 -1
  31. data/rails_generators/feature/feature_generator.rb +1 -1
  32. data/spec/cucumber/cli/configuration_spec.rb +0 -3
  33. data/spec/cucumber/formatter/color_io_spec.rb +1 -0
  34. data/spec/cucumber/formatter/progress_spec.rb +1 -0
  35. metadata +6 -4
  36. data/examples/self_test/features/support/tag_count_formatter.rb +0 -25
  37. data/lib/cucumber/formatter.rb +0 -1
@@ -76,6 +76,7 @@ module Cucumber
76
76
 
77
77
  def visit_feature_element(feature_element)
78
78
  @indent = 2
79
+ @scenario_indent = 2
79
80
  super
80
81
  @io.puts
81
82
  @io.flush
@@ -83,6 +84,7 @@ module Cucumber
83
84
 
84
85
  def visit_background(background)
85
86
  @indent = 2
87
+ @scenario_indent = 2
86
88
  @in_background = true
87
89
  super
88
90
  @in_background = nil
@@ -100,6 +102,7 @@ module Cucumber
100
102
  names[1..-1].each {|s| @io.puts " #{s}" }
101
103
  @io.flush
102
104
  @indent = 6
105
+ @scenario_indent = 6
103
106
  end
104
107
 
105
108
  def visit_scenario_name(keyword, name, file_colon_line, source_indent)
@@ -107,8 +110,9 @@ module Cucumber
107
110
  end
108
111
 
109
112
  def visit_feature_element_name(keyword, name, file_colon_line, source_indent)
113
+ @io.puts if @scenario_indent == 6
110
114
  names = name.empty? ? [name] : name.split("\n")
111
- line = " #{keyword} #{names[0]}"
115
+ line = "#{keyword} #{names[0]}".indent(@scenario_indent)
112
116
  @io.print(line)
113
117
  if @options[:source]
114
118
  line_comment = " # #{file_colon_line}".indent(source_indent)
@@ -137,7 +141,7 @@ module Cucumber
137
141
  def visit_step_name(keyword, step_match, status, source_indent, background)
138
142
  source_indent = nil unless @options[:source]
139
143
  formatted_step_name = format_step(keyword, step_match, status, source_indent)
140
- @io.puts(" " + formatted_step_name)
144
+ @io.puts(formatted_step_name.indent(@scenario_indent + 2))
141
145
  end
142
146
 
143
147
  def visit_multiline_arg(multiline_arg)
@@ -177,6 +181,7 @@ module Cucumber
177
181
  def print_summary
178
182
  print_counts
179
183
  print_snippets(@options)
184
+ print_passing_wip(@options)
180
185
  end
181
186
 
182
187
  end
@@ -35,6 +35,7 @@ module Cucumber
35
35
  print_steps(:failed)
36
36
  print_counts
37
37
  print_snippets(@options)
38
+ print_passing_wip(@options)
38
39
  end
39
40
 
40
41
  CHARS = {
@@ -0,0 +1,27 @@
1
+ module Cucumber
2
+ module Formatter
3
+ # Custom formatter that prints a tag cloud
4
+ class TagCloud < Cucumber::Ast::Visitor
5
+ def initialize(step_mother, io, options)
6
+ super(step_mother)
7
+ @io = io
8
+ @counts = Hash.new{|h,k| h[k] = 0}
9
+ end
10
+
11
+ def visit_features(features)
12
+ super
13
+ print_summary
14
+ end
15
+
16
+ def visit_tag_name(tag_name)
17
+ @counts[tag_name] += 1
18
+ end
19
+
20
+ def print_summary
21
+ matrix = @counts.to_a.sort{|paira, pairb| paira[0] <=> pairb[0]}.transpose
22
+ table = Cucumber::Ast::Table.new(matrix)
23
+ Cucumber::Formatter::Pretty.new(@step_mother, @io, {}).visit_multiline_arg(table)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -43,6 +43,36 @@
43
43
  and: و
44
44
  but: لكن
45
45
  space_after_keyword: true
46
+ "bg":
47
+ name: Bulgarian
48
+ native: български
49
+ encoding: UTF-8
50
+ feature: Функционалност
51
+ background: Предистория
52
+ scenario: Сценарий
53
+ scenario_outline: Рамка на сценарий
54
+ examples: Примери
55
+ given: Дадено
56
+ when: Когато
57
+ then: То
58
+ and: И
59
+ but: Но
60
+ space_after_keyword: true
61
+ "cat":
62
+ name: Catalan
63
+ native: català
64
+ encoding: UTF-8
65
+ background: Rerefons
66
+ feature: Característica
67
+ scenario: Escenari
68
+ scenario_outline: Esquema de l\'escenari
69
+ examples: Exemples
70
+ given: Donat
71
+ when: Quan
72
+ then: Aleshores
73
+ and: I
74
+ but: Però
75
+ space_after_keyword: true
46
76
  "cy":
47
77
  name: Welsh
48
78
  native: Cymraeg
@@ -161,21 +191,6 @@
161
191
  and: Y
162
192
  but: Pero
163
193
  space_after_keyword: true
164
- "cat":
165
- name: Catalan
166
- native: català
167
- encoding: UTF-8
168
- background: Rerefons
169
- feature: Característica
170
- scenario: Escenari
171
- scenario_outline: Esquema de l\'escenari
172
- examples: Exemples
173
- given: Donat
174
- when: Quan
175
- then: Aleshores
176
- and: I
177
- but: Però
178
- space_after_keyword: true
179
194
  "et":
180
195
  name: Estonian
181
196
  native: eesti keel
@@ -296,6 +311,21 @@
296
311
  and: かつ
297
312
  but: しかし|但し
298
313
  space_after_keyword: false
314
+ "ko":
315
+ name: Korean
316
+ native: 한국어
317
+ encoding: UTF-8
318
+ background: 배경
319
+ feature: 기능
320
+ scenario: 시나리오
321
+ scenario_outline: 시나리오 개요
322
+ examples: 예
323
+ given: 조건
324
+ when: 만일
325
+ then: 그러면
326
+ and: 그리고
327
+ but: 하지만
328
+ space_after_keyword: false
299
329
  "lt":
300
330
  name: Lithuanian
301
331
  native: lietuvių kalba
@@ -455,6 +485,21 @@
455
485
  and: A
456
486
  but: Ale
457
487
  space_after_keyword: true
488
+ "vi":
489
+ name: Vietnamese
490
+ native: Tiếng Việt
491
+ encoding: UTF-8
492
+ feature: Tính năng
493
+ background: Bối cảnh
494
+ scenario: Tình huống|Kịch bản
495
+ scenario_outline: Khung tình huống|Khung kịch bản
496
+ examples: Dữ liệu
497
+ given: Biết|Cho
498
+ when: Khi
499
+ then: Thì
500
+ and: Và
501
+ but: Nhưng
502
+ space_after_keyword: true
458
503
  "zh-CN":
459
504
  name: Chinese simplified
460
505
  native: 简体中文
@@ -485,48 +530,3 @@
485
530
  and: 而且|並且
486
531
  but: 但是
487
532
  space_after_keyword: false
488
- "ko":
489
- name: Korean
490
- native: 한국어
491
- encoding: UTF-8
492
- background: 배경
493
- feature: 기능
494
- scenario: 시나리오
495
- scenario_outline: 시나리오 개요
496
- examples: 예
497
- given: 조건
498
- when: 만일
499
- then: 그러면
500
- and: 그리고
501
- but: 하지만
502
- space_after_keyword: false
503
- "bg":
504
- name: Bulgarian
505
- native: български
506
- encoding: UTF-8
507
- feature: Функционалност
508
- background: Предистория
509
- scenario: Сценарий
510
- scenario_outline: Рамка на сценарий
511
- examples: Примери
512
- given: Дадено
513
- when: Когато
514
- then: То
515
- and: И
516
- but: Но
517
- space_after_keyword: true
518
- "vi":
519
- name: Vietnamese
520
- native: Tiếng Việt
521
- encoding: UTF-8
522
- feature: Tính năng
523
- background: Bối cảnh
524
- scenario: Kịch bản
525
- scenario_outline: Khung kịch bản
526
- examples: Dữ liệu
527
- given: Cho
528
- when: Khi
529
- then: Thì
530
- and: Và
531
- but: Nhưng
532
- space_after_keyword: true
@@ -68,13 +68,26 @@ module Cucumber #:nodoc:
68
68
 
69
69
  def self.bypass_rescue
70
70
  ActionController::Base.class_eval do
71
+ alias_method :rescue_action_without_bypass, :rescue_action
72
+
71
73
  def rescue_action(exception)
72
74
  raise exception
73
75
  end
74
76
  end
75
- ActionController::Dispatcher.class_eval do
76
- def self.failsafe_response(output, status, exception = nil)
77
- raise exception
77
+
78
+ begin
79
+ ActionController::Failsafe.class_eval do
80
+ alias_method :failsafe_response_without_bypass, :failsafe_response
81
+
82
+ def failsafe_response(exception)
83
+ raise exception
84
+ end
85
+ end
86
+ rescue NameError # Failsafe was introduced in Rails 2.3.2
87
+ ActionController::Dispatcher.class_eval do
88
+ def self.failsafe_response(output, status, exception = nil)
89
+ raise exception
90
+ end
78
91
  end
79
92
  end
80
93
  end
@@ -135,7 +135,8 @@ module Cucumber
135
135
  attr_accessor :fork
136
136
 
137
137
  # Define what profile to be used. When used with cucumber_opts it is simply appended to it. Will be ignored when CUCUMBER_OPTS is used.
138
- def profile=(profile)
138
+ attr_accessor :profile
139
+ def profile=(profile) #:nodoc:
139
140
  @profile = profile
140
141
  unless feature_list
141
142
  # TODO: remove once we completely remove these from the rake task.
@@ -143,7 +144,6 @@ module Cucumber
143
144
  @feature_list = [] # Don't use accessor to avoid deprecation warning.
144
145
  end
145
146
  end
146
- attr_reader :profile
147
147
 
148
148
  # Define Cucumber Rake task
149
149
  def initialize(task_name = "features", desc = "Run Features with Cucumber")
@@ -33,12 +33,13 @@ module Cucumber
33
33
  class NoStepMatch
34
34
  attr_reader :step_definition
35
35
 
36
- def initialize(step)
36
+ def initialize(step, name)
37
37
  @step = step
38
+ @name = name
38
39
  end
39
40
 
40
41
  def format_args(format)
41
- @step.name
42
+ @name
42
43
  end
43
44
 
44
45
  def file_colon_line
@@ -78,8 +78,16 @@ module Cucumber
78
78
  @tag_names.empty? || (@tag_names & tag_names).any?
79
79
  end
80
80
 
81
- def execute_in(world, scenario, location)
82
- world.cucumber_instance_exec(false, location, scenario, &@proc)
81
+ def execute_in(world, scenario, location, exception_fails_scenario = true)
82
+ begin
83
+ world.cucumber_instance_exec(false, location, scenario, &@proc)
84
+ rescue Exception => exception
85
+ if exception_fails_scenario
86
+ scenario.fail!(exception)
87
+ else
88
+ raise
89
+ end
90
+ end
83
91
  end
84
92
  end
85
93
 
@@ -143,6 +151,10 @@ module Cucumber
143
151
  register_hook(:after, tag_names, proc)
144
152
  end
145
153
 
154
+ def AfterStep(*tag_names, &proc)
155
+ register_hook(:after_step, tag_names, proc)
156
+ end
157
+
146
158
  def register_hook(phase, tags, proc)
147
159
  hook = Hook.new(tags, proc)
148
160
  hooks[phase] << hook
@@ -233,7 +245,9 @@ module Cucumber
233
245
 
234
246
  def before_and_after(scenario, skip=false)
235
247
  before(scenario) unless skip
236
- yield
248
+ @current_scenario = scenario
249
+ yield scenario
250
+ @current_scenario = nil
237
251
  after(scenario) unless skip
238
252
  scenario_visited(scenario)
239
253
  end
@@ -249,7 +263,11 @@ module Cucumber
249
263
  execute_after(scenario)
250
264
  nil_world!
251
265
  end
252
-
266
+
267
+ def after_step
268
+ execute_after_step(@current_scenario)
269
+ end
270
+
253
271
  private
254
272
 
255
273
  def max_step_definition_length
@@ -323,6 +341,13 @@ module Cucumber
323
341
  end
324
342
  end
325
343
 
344
+ def execute_after_step(scenario)
345
+ return if options[:dry_run]
346
+ hooks_for(:after_step, scenario).each do |hook|
347
+ hook.execute_in(@current_world, scenario, 'AfterStep', false)
348
+ end
349
+ end
350
+
326
351
  def scenario_visited(scenario)
327
352
  scenarios << scenario unless scenarios.index(scenario)
328
353
  end
@@ -2,8 +2,8 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 5
6
- PATCH = nil # Set to nil for official release
5
+ TINY = 6
6
+ PATCH = 1 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -5,7 +5,7 @@ begin
5
5
 
6
6
  Cucumber::Rake::Task.new(:features) do |t|
7
7
  t.fork = true
8
- t.cucumber_opts = %w{--format pretty}
8
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
9
9
  end
10
10
  task :features => 'db:test:prepare'
11
11
  rescue LoadError
@@ -1,4 +1,4 @@
1
- # This generator bootstraps a Rails project for use with Cucumber
1
+ # This generator generates a baic feature.
2
2
  class FeatureGenerator < Rails::Generator::NamedBase
3
3
  def manifest
4
4
  record do |m|
@@ -81,11 +81,8 @@ module Cli
81
81
  "/features/support/fooz.rb"
82
82
  ]
83
83
  end
84
-
85
-
86
84
  end
87
85
 
88
-
89
86
  it "should expand args from YAML file" do
90
87
  given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
91
88
 
@@ -1,4 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'cucumber/formatter/color_io'
2
3
 
3
4
  module Cucumber
4
5
  module Formatter
@@ -1,4 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'cucumber/formatter/progress'
2
3
 
3
4
  module Cucumber
4
5
  module Formatter
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.5
4
+ version: 0.3.6.1
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-05-15 00:00:00 -07:00
12
+ date: 2009-05-20 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -267,7 +267,6 @@ files:
267
267
  - examples/self_test/features/search_sample.feature
268
268
  - examples/self_test/features/step_definitions/sample_steps.rb
269
269
  - examples/self_test/features/support/env.rb
270
- - examples/self_test/features/support/tag_count_formatter.rb
271
270
  - examples/self_test/features/tons_of_cukes.feature
272
271
  - examples/self_test/features/undefined_multiline_args.feature
273
272
  - examples/sinatra/Rakefile
@@ -315,6 +314,8 @@ files:
315
314
  - examples/watir/features/search.feature
316
315
  - examples/watir/features/step_definitons/search_steps.rb
317
316
  - examples/watir/features/support/env.rb
317
+ - features/after_block_exceptions.feature
318
+ - features/after_step_block_exceptions.feature
318
319
  - features/background.feature
319
320
  - features/cucumber_cli.feature
320
321
  - features/cucumber_cli_diff_disabled.feature
@@ -330,6 +331,7 @@ files:
330
331
  - features/step_definitions/extra_steps.rb
331
332
  - features/support/env.rb
332
333
  - features/usage.feature
334
+ - features/work_in_progress.feature
333
335
  - gem_tasks/deployment.rake
334
336
  - gem_tasks/environment.rake
335
337
  - gem_tasks/features.rake
@@ -370,7 +372,6 @@ files:
370
372
  - lib/cucumber/core_ext/instance_exec.rb
371
373
  - lib/cucumber/core_ext/proc.rb
372
374
  - lib/cucumber/core_ext/string.rb
373
- - lib/cucumber/formatter.rb
374
375
  - lib/cucumber/formatter/ansicolor.rb
375
376
  - lib/cucumber/formatter/color_io.rb
376
377
  - lib/cucumber/formatter/console.rb
@@ -382,6 +383,7 @@ files:
382
383
  - lib/cucumber/formatter/profile.rb
383
384
  - lib/cucumber/formatter/progress.rb
384
385
  - lib/cucumber/formatter/rerun.rb
386
+ - lib/cucumber/formatter/tag_cloud.rb
385
387
  - lib/cucumber/formatter/unicode.rb
386
388
  - lib/cucumber/formatter/usage.rb
387
389
  - lib/cucumber/formatters/unicode.rb