cucumber 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +17 -0
- data/Manifest.txt +3 -2
- data/README.txt +3 -2
- data/config/hoe.rb +1 -0
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/Rakefile +18 -2
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +2 -1
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +2 -1
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +2 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +2 -1
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +2 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +2 -1
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +2 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +2 -1
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -1
- data/examples/java/features/step_definitons/hello_steps.rb +1 -1
- data/examples/java/features/step_definitons/tree_steps.rb +1 -1
- data/examples/selenium/features/step_definitons/stories_steps.rb +1 -1
- data/examples/tickets/features/scenario_outline.feature +26 -0
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +1 -1
- data/examples/watir/README.textile +16 -0
- data/examples/watir/features/step_definitons/search_steps.rb +27 -0
- data/examples/watir/features/support/env.rb +32 -0
- data/gem_tasks/deployment.rake +0 -23
- data/gem_tasks/gemspec.rake +4 -0
- data/gem_tasks/rspec.rake +2 -2
- data/gem_tasks/treetop.rake +1 -1
- data/lib/autotest/cucumber_mixin.rb +1 -5
- data/lib/cucumber.rb +0 -21
- data/lib/cucumber/cli.rb +2 -1
- data/lib/cucumber/core_ext/string.rb +1 -1
- data/lib/cucumber/formatters/ansicolor.rb +8 -3
- data/lib/cucumber/formatters/pretty_formatter.rb +17 -8
- data/lib/cucumber/formatters/unicode.rb +5 -5
- data/lib/cucumber/platform.rb +28 -6
- data/lib/cucumber/rails/rspec.rb +1 -1
- data/lib/cucumber/rails/world.rb +1 -1
- data/lib/cucumber/rake/task.rb +3 -3
- data/lib/cucumber/treetop_parser/feature.treetop.erb +1 -0
- data/lib/cucumber/treetop_parser/feature_ar.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_cy.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_da.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_de.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_en.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_es.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_et.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_fr.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_id.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_it.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_ja.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_lt.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_nl.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_no.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_parser.rb +3 -1
- data/lib/cucumber/treetop_parser/feature_pl.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_pt.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_ro.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_ro2.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_ru.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_se.rb +1 -0
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1 -0
- data/lib/cucumber/version.rb +3 -2
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +46 -2
- data/spec/cucumber/model/table_spec.rb +19 -5
- data/spec/cucumber/rails/stubs/mini_rails.rb +4 -3
- data/spec/cucumber/tree/step_outline_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +5 -4
- data/examples/java/src/cucumber/demo/Hello.java +0 -16
- data/examples/watir/features/step_definitons/stories_steps.rb +0 -51
@@ -122,10 +122,6 @@ module Autotest::CucumberMixin
|
|
122
122
|
else
|
123
123
|
scenario_args = scenarios_to_run.map { |s| "-s '#{s}'" }.join(' ')
|
124
124
|
end
|
125
|
-
return "#{
|
126
|
-
end
|
127
|
-
|
128
|
-
def cucumber
|
129
|
-
File.file?("script/cucumber") ? "script/cucumber" : "cucumber"
|
125
|
+
return "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{args} #{scenario_args}"
|
130
126
|
end
|
131
127
|
end
|
data/lib/cucumber.rb
CHANGED
@@ -17,24 +17,3 @@ require 'cucumber/cli'
|
|
17
17
|
require 'cucumber/broadcaster'
|
18
18
|
require 'cucumber/world'
|
19
19
|
require 'cucumber/core_ext/exception'
|
20
|
-
|
21
|
-
module Cucumber
|
22
|
-
LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/cucumber/languages.yml')
|
23
|
-
|
24
|
-
class << self
|
25
|
-
attr_reader :language
|
26
|
-
|
27
|
-
def load_language(lang)
|
28
|
-
@language = config[lang]
|
29
|
-
end
|
30
|
-
|
31
|
-
def languages
|
32
|
-
config.keys.sort
|
33
|
-
end
|
34
|
-
|
35
|
-
def config
|
36
|
-
require 'yaml'
|
37
|
-
@config ||= YAML.load_file(LANGUAGE_FILE)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/lib/cucumber/cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'optparse'
|
2
2
|
require 'cucumber'
|
3
|
+
require 'ostruct'
|
3
4
|
|
4
5
|
module Cucumber
|
5
6
|
class YmlLoadError < StandardError; end
|
@@ -344,7 +345,7 @@ Defined profiles in cucumber.yml:
|
|
344
345
|
def enable_diffing
|
345
346
|
if defined?(::Spec)
|
346
347
|
require 'spec/expectations/differs/default'
|
347
|
-
options =
|
348
|
+
options = OpenStruct.new(:diff_format => :unified, :context_lines => 3)
|
348
349
|
::Spec::Expectations.differ = ::Spec::Expectations::Differs::Default.new(options)
|
349
350
|
end
|
350
351
|
end
|
@@ -5,7 +5,7 @@ gem 'term-ansicolor'
|
|
5
5
|
$LOAD_PATH.each{|path| $LOAD_PATH.unshift($LOAD_PATH.delete(path)) if path =~ /term-ansicolor/}
|
6
6
|
require 'term/ansicolor'
|
7
7
|
|
8
|
-
if
|
8
|
+
if Cucumber::WINDOWS_MRI
|
9
9
|
begin
|
10
10
|
require 'Win32/Console/ANSI'
|
11
11
|
rescue LoadError
|
@@ -14,23 +14,26 @@ if $CUCUMBER_WINDOWS_MRI
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
Term::ANSIColor.coloring = false if !STDOUT.tty? || (
|
17
|
+
Term::ANSIColor.coloring = false if !STDOUT.tty? || (Cucumber::WINDOWS && !Cucumber::WINDOWS_MRI)
|
18
18
|
|
19
19
|
module Cucumber
|
20
20
|
module Formatters
|
21
21
|
# Defines aliases for coloured output. You can tweak the colours by defining
|
22
|
-
# a <tt
|
22
|
+
# a <tt>CUCUMBER_COLORS</tt> variable in your shell, very much like you can
|
23
23
|
# tweak the familiar POSIX command <tt>ls</tt> with
|
24
24
|
# <a href="http://mipsisrisc.com/rambling/2008/06/27/lscolorsls_colors-now-with-linux-support/">$LSCOLORS/$LS_COLORS</a>
|
25
25
|
#
|
26
26
|
# The colours that you can change are:
|
27
27
|
#
|
28
|
+
# * <tt>missing</tt> - defaults to <tt>yellow</tt>
|
28
29
|
# * <tt>pending</tt> - defaults to <tt>yellow</tt>
|
29
30
|
# * <tt>pending_param</tt> - defaults to <tt>yellow,bold</tt>
|
30
31
|
# * <tt>failed</tt> - defaults to <tt>red</tt>
|
31
32
|
# * <tt>failed_param</tt> - defaults to <tt>red,bold</tt>
|
32
33
|
# * <tt>passed</tt> - defaults to <tt>green</tt>
|
33
34
|
# * <tt>passed_param</tt> - defaults to <tt>green,bold</tt>
|
35
|
+
# * <tt>outline</tt> - defaults to <tt>cyan</tt>
|
36
|
+
# * <tt>outline_param</tt> - defaults to <tt>cyan,bold</tt>
|
34
37
|
# * <tt>skipped</tt> - defaults to <tt>cyan</tt>
|
35
38
|
# * <tt>skipped_param</tt> - defaults to <tt>cyan,bold</tt>
|
36
39
|
# * <tt>comment</tt> - defaults to <tt>grey</tt>
|
@@ -66,9 +69,11 @@ module Cucumber
|
|
66
69
|
h[$1] + ',bold'
|
67
70
|
end
|
68
71
|
end.merge({
|
72
|
+
'missing' => 'yellow',
|
69
73
|
'pending' => 'yellow',
|
70
74
|
'failed' => 'red',
|
71
75
|
'passed' => 'green',
|
76
|
+
'outline' => 'cyan',
|
72
77
|
'skipped' => 'cyan',
|
73
78
|
'comment' => 'grey',
|
74
79
|
'tag' => 'blue'
|
@@ -19,6 +19,8 @@ module Cucumber
|
|
19
19
|
@last_executed_was_row = false
|
20
20
|
@pending_messages = {}
|
21
21
|
@forced_pending_step_count = 0
|
22
|
+
|
23
|
+
@total_scenario_count = 0
|
22
24
|
end
|
23
25
|
|
24
26
|
def feature_executing(feature)
|
@@ -81,6 +83,7 @@ module Cucumber
|
|
81
83
|
@io.puts
|
82
84
|
output_failing_step(@failed.last)
|
83
85
|
end
|
86
|
+
@total_scenario_count += 1
|
84
87
|
end
|
85
88
|
|
86
89
|
def step_passed(step, regexp, args)
|
@@ -100,14 +103,13 @@ module Cucumber
|
|
100
103
|
end
|
101
104
|
|
102
105
|
def step_failed(step, regexp, args)
|
106
|
+
@scenario_failed = true
|
103
107
|
if step.row?
|
104
108
|
args = step.visible_args if step.outline?
|
105
109
|
@failed << step
|
106
|
-
@scenario_failed = true
|
107
110
|
print_failed_args(args)
|
108
111
|
else
|
109
112
|
@failed << step
|
110
|
-
@scenario_failed = true
|
111
113
|
@io.print failed(" #{step.keyword} #{step.format(regexp){|param| failed_param(param) << failed}}")
|
112
114
|
if @options[:source]
|
113
115
|
@io.print padding_spaces(step)
|
@@ -176,13 +178,16 @@ module Cucumber
|
|
176
178
|
|
177
179
|
print_pending_messages if @pending_messages.any?
|
178
180
|
|
179
|
-
@io.puts
|
181
|
+
@io.puts dump_count(@total_scenario_count, "scenario")
|
182
|
+
|
183
|
+
@io.puts pending(dump_count(@pending_scenarios.length, "scenario", "pending")) if @pending_scenarios.any?
|
184
|
+
|
185
|
+
@io.puts passed(dump_count(@passed.length, "step", "passed")) if @passed.any?
|
186
|
+
@io.puts passed(dump_count(@failed.length, "step", "failed")) if @failed.any?
|
187
|
+
@io.puts passed(dump_count(@skipped.length, "step", "skipped")) if @skipped.any?
|
180
188
|
|
181
|
-
@io.puts passed("#{@passed.length} steps passed") if @passed.any?
|
182
|
-
@io.puts failed("#{@failed.length} steps failed") if @failed.any?
|
183
|
-
@io.puts skipped("#{@skipped.length} steps skipped") if @skipped.any?
|
184
189
|
if @pending_steps.any?
|
185
|
-
@io.print pending(
|
190
|
+
@io.print pending(dump_count(@pending_steps.length, "step", "pending"))
|
186
191
|
@io.print pending(" (#{number_of_unimplemented_steps} with no step definition)") if number_of_unimplemented_steps > 0
|
187
192
|
@io.puts
|
188
193
|
end
|
@@ -191,6 +196,10 @@ module Cucumber
|
|
191
196
|
|
192
197
|
print_snippets if @options[:snippets]
|
193
198
|
end
|
199
|
+
|
200
|
+
def dump_count(count, what, state=nil)
|
201
|
+
return [count, "#{what}#{count == 1 ? '' : 's'}", state].compact.join(" ")
|
202
|
+
end
|
194
203
|
|
195
204
|
def print_pending_messages
|
196
205
|
@io.puts "Pending Notes:"
|
@@ -199,7 +208,7 @@ module Cucumber
|
|
199
208
|
end
|
200
209
|
@io.puts
|
201
210
|
end
|
202
|
-
|
211
|
+
|
203
212
|
def print_snippets
|
204
213
|
snippets = @pending_steps
|
205
214
|
snippets.delete_if {|snippet| snippet.row? || @step_mother.has_step_definition?(snippet.name)}
|
@@ -2,25 +2,25 @@
|
|
2
2
|
require 'cucumber/platform'
|
3
3
|
require 'cucumber/formatters/ansicolor'
|
4
4
|
|
5
|
-
$KCODE='u'
|
5
|
+
$KCODE='u' unless Cucumber::RUBY_1_9
|
6
6
|
|
7
|
-
if
|
7
|
+
if Cucumber::WINDOWS_MRI && `chcp` =~ /Active code page: (\d+)/
|
8
8
|
codepage = $1.to_i
|
9
9
|
codepages = (1251..1252)
|
10
10
|
|
11
11
|
if codepages.include?(codepage)
|
12
|
-
|
12
|
+
Cucumber::CODEPAGE = "cp#{codepage}"
|
13
13
|
|
14
14
|
require 'iconv'
|
15
15
|
module Kernel
|
16
16
|
alias cucumber_print print
|
17
17
|
def print(*a)
|
18
|
-
cucumber_print *Iconv.iconv(
|
18
|
+
cucumber_print *Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a)
|
19
19
|
end
|
20
20
|
|
21
21
|
alias cucumber_puts puts
|
22
22
|
def puts(*a)
|
23
|
-
cucumber_puts *Iconv.iconv(
|
23
|
+
cucumber_puts *Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/cucumber/platform.rb
CHANGED
@@ -2,9 +2,31 @@
|
|
2
2
|
# in various places.
|
3
3
|
require 'rbconfig'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
module Cucumber
|
6
|
+
LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/languages.yml')
|
7
|
+
BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
|
8
|
+
JRUBY = defined?(JRUBY_VERSION)
|
9
|
+
IRONRUBY = Config::CONFIG['sitedir'] =~ /IronRuby/
|
10
|
+
WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
|
11
|
+
WINDOWS_MRI = WINDOWS && !JRUBY && !IRONRUBY
|
12
|
+
RAILS = defined?(Rails)
|
13
|
+
RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
14
|
+
RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
|
15
|
+
|
16
|
+
class << self
|
17
|
+
attr_reader :language
|
18
|
+
|
19
|
+
def load_language(lang)
|
20
|
+
@language = config[lang]
|
21
|
+
end
|
22
|
+
|
23
|
+
def languages
|
24
|
+
config.keys.sort
|
25
|
+
end
|
26
|
+
|
27
|
+
def config
|
28
|
+
require 'yaml'
|
29
|
+
@config ||= YAML.load_file(LANGUAGE_FILE)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/cucumber/rails/rspec.rb
CHANGED
data/lib/cucumber/rails/world.rb
CHANGED
data/lib/cucumber/rake/task.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cucumber/platform'
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Rake
|
3
5
|
# Defines a task for running features.
|
@@ -5,7 +7,6 @@ module Cucumber
|
|
5
7
|
LIB = File.expand_path(File.dirname(__FILE__) + '/../..')
|
6
8
|
|
7
9
|
attr_accessor :libs
|
8
|
-
attr_accessor :binary
|
9
10
|
attr_accessor :step_list
|
10
11
|
attr_accessor :step_pattern
|
11
12
|
attr_accessor :feature_list
|
@@ -24,7 +25,6 @@ module Cucumber
|
|
24
25
|
|
25
26
|
@feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
|
26
27
|
@step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
|
27
|
-
@binary ||= File.expand_path(File.dirname(__FILE__) + '/../../../bin/cucumber')
|
28
28
|
define_task
|
29
29
|
end
|
30
30
|
|
@@ -37,7 +37,7 @@ module Cucumber
|
|
37
37
|
|
38
38
|
def arguments_for_ruby_execution(task_args = nil)
|
39
39
|
lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)]
|
40
|
-
cucumber_bin = ['"%s"' %
|
40
|
+
cucumber_bin = ['"%s"' % Cucumber::BINARY]
|
41
41
|
cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)]
|
42
42
|
|
43
43
|
step_files(task_args).each do |step_file|
|
@@ -20,7 +20,9 @@ module Cucumber
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_feature(file)
|
23
|
-
|
23
|
+
gherkin = IO.read(file)
|
24
|
+
gherkin = gherkin.force_encoding('utf-8') if Cucumber::RUBY_1_9
|
25
|
+
ast = parse(gherkin)
|
24
26
|
if ast.nil?
|
25
27
|
raise SyntaxError.new(file, self)
|
26
28
|
else
|