kosmas58-cucumber 0.3.96 → 0.3.97
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +22 -3
- data/License.txt +2 -0
- data/Manifest.txt +9 -5
- data/config/hoe.rb +1 -0
- data/examples/i18n/Rakefile +5 -3
- data/examples/i18n/fi/features/yhteenlasku.feature +5 -4
- data/examples/python/features/step_definitions/fib_steps.py +3 -0
- data/examples/python/features/support/env.rb +21 -21
- data/gem_tasks/contributors.rake +8 -0
- data/gem_tasks/features.rake +1 -0
- data/gem_tasks/sdoc.rake +7 -0
- data/lib/README.rdoc +12 -0
- data/lib/cucumber/ast/background.rb +1 -1
- data/lib/cucumber/ast/comment.rb +1 -1
- data/lib/cucumber/ast/examples.rb +9 -4
- data/lib/cucumber/ast/feature.rb +1 -1
- data/lib/cucumber/ast/feature_element.rb +1 -1
- data/lib/cucumber/ast/features.rb +1 -1
- data/lib/cucumber/ast/outline_table.rb +2 -2
- data/lib/cucumber/ast/py_string.rb +1 -1
- data/lib/cucumber/ast/scenario.rb +1 -1
- data/lib/cucumber/ast/scenario_outline.rb +8 -7
- data/lib/cucumber/ast/step.rb +1 -1
- data/lib/cucumber/ast/step_collection.rb +1 -1
- data/lib/cucumber/ast/step_invocation.rb +1 -1
- data/lib/cucumber/ast/table.rb +65 -45
- data/lib/cucumber/ast/tags.rb +2 -2
- data/lib/cucumber/ast/visitor.rb +6 -8
- data/lib/cucumber/broadcaster.rb +1 -1
- data/lib/cucumber/cli/language_help_formatter.rb +1 -1
- data/lib/cucumber/cli/main.rb +15 -52
- data/lib/cucumber/constantize.rb +1 -1
- data/lib/cucumber/core_ext/exception.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +8 -3
- data/lib/cucumber/core_ext/proc.rb +1 -1
- data/lib/cucumber/core_ext/string.rb +1 -1
- data/lib/cucumber/feature_file.rb +4 -3
- data/lib/cucumber/filter.rb +2 -1
- data/lib/cucumber/formatter/ansicolor.rb +6 -5
- data/lib/cucumber/formatter/color_io.rb +2 -2
- data/lib/cucumber/formatter/console.rb +2 -0
- data/lib/cucumber/formatter/duration.rb +3 -0
- data/lib/cucumber/formatter/html.rb +1 -0
- data/lib/cucumber/formatter/junit.rb +1 -0
- data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +18 -4
- data/lib/cucumber/formatter/profile.rb +1 -0
- data/lib/cucumber/formatter/progress.rb +1 -0
- data/lib/cucumber/formatter/rerun.rb +2 -0
- data/lib/cucumber/formatter/steps.rb +1 -0
- data/lib/cucumber/formatter/tag_cloud.rb +2 -1
- data/lib/cucumber/formatter/unicode.rb +1 -1
- data/lib/cucumber/formatter/usage.rb +1 -0
- data/lib/cucumber/language_support/language_methods.rb +34 -12
- data/lib/cucumber/language_support.rb +30 -0
- data/lib/cucumber/parser/feature.rb +81 -57
- data/lib/cucumber/parser/feature.tt +3 -3
- data/lib/cucumber/parser/natural_language.rb +1 -1
- data/lib/cucumber/parser/table.rb +3 -0
- data/lib/cucumber/parser/treetop_ext.rb +6 -5
- data/lib/cucumber/platform.rb +1 -2
- data/lib/cucumber/py_support/py_dsl.py +8 -0
- data/lib/cucumber/py_support/py_language.py +2 -0
- data/lib/cucumber/py_support/py_language.rb +68 -0
- data/lib/cucumber/rails/world.rb +2 -1
- data/lib/cucumber/rake/task.rb +13 -11
- data/lib/cucumber/rb_support/rb_dsl.rb +27 -15
- data/lib/cucumber/rb_support/rb_hook.rb +1 -2
- data/lib/cucumber/rb_support/rb_language.rb +57 -33
- data/lib/cucumber/rb_support/rb_step_definition.rb +42 -38
- data/lib/cucumber/rb_support/rb_world.rb +93 -0
- data/lib/cucumber/rspec_neuter.rb +3 -3
- data/lib/cucumber/step_match.rb +2 -2
- data/lib/cucumber/step_mother.rb +91 -65
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/webrat/element_locator.rb +3 -3
- data/rails_generators/cucumber/templates/cucumber.rake +2 -0
- data/rails_generators/cucumber/templates/en/webrat_steps.rb +4 -0
- data/spec/cucumber/ast/background_spec.rb +8 -1
- data/spec/cucumber/ast/scenario_outline_spec.rb +1 -0
- data/spec/cucumber/ast/table_spec.rb +10 -0
- data/spec/cucumber/cli/options_spec.rb +1 -1
- data/spec/cucumber/parser/feature_parser_spec.rb +4 -0
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +114 -0
- data/spec/cucumber/step_mother_spec.rb +29 -10
- data/spec/cucumber/treetop_parser/with_comments.feature +14 -1
- data/spec/cucumber/world/pending_spec.rb +1 -1
- metadata +21 -7
- data/gem_tasks/yard.rake +0 -8
- data/lib/cucumber/language_support/hook_methods.rb +0 -9
- data/lib/cucumber/world.rb +0 -89
- data/spec/cucumber/ast/visitor_spec.rb +0 -27
- data/spec/cucumber/step_definition_spec.rb +0 -102
@@ -2,9 +2,22 @@
|
|
2
2
|
# Two lines
|
3
3
|
Feature: Some header
|
4
4
|
|
5
|
+
Background:
|
6
|
+
# comment
|
7
|
+
Given whatever
|
8
|
+
|
5
9
|
# Scenario header
|
6
10
|
# on two lines
|
7
11
|
Scenario: Some scenario
|
8
12
|
Given one
|
9
13
|
# When two
|
10
|
-
Then three
|
14
|
+
Then three
|
15
|
+
|
16
|
+
Scenario Outline: Some outline
|
17
|
+
Given <one>
|
18
|
+
Then <two>
|
19
|
+
|
20
|
+
# Examples group comment
|
21
|
+
Examples:
|
22
|
+
| one | two |
|
23
|
+
| a | b |
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kosmas58-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.97
|
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-08-
|
12
|
+
date: 2009-08-23 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.3.0
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: polyglot
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.2.8
|
44
|
+
version:
|
35
45
|
- !ruby/object:Gem::Dependency
|
36
46
|
name: diff-lcs
|
37
47
|
type: :runtime
|
@@ -235,6 +245,7 @@ files:
|
|
235
245
|
- examples/junit/features/step_definitions/steps.rb
|
236
246
|
- examples/pure_java/README.textile
|
237
247
|
- examples/python/features/fibonacci.feature
|
248
|
+
- examples/python/features/step_definitions/fib_steps.py
|
238
249
|
- examples/python/features/step_definitions/fib_steps.rb
|
239
250
|
- examples/python/features/support/env.rb
|
240
251
|
- examples/python/lib/fib.py
|
@@ -356,7 +367,8 @@ files:
|
|
356
367
|
- gem_tasks/gemspec.rake
|
357
368
|
- gem_tasks/rspec.rake
|
358
369
|
- gem_tasks/sass.rake
|
359
|
-
- gem_tasks/
|
370
|
+
- gem_tasks/sdoc.rake
|
371
|
+
- lib/README.rdoc
|
360
372
|
- lib/autotest/cucumber.rb
|
361
373
|
- lib/autotest/cucumber_mixin.rb
|
362
374
|
- lib/autotest/cucumber_rails.rb
|
@@ -413,7 +425,7 @@ files:
|
|
413
425
|
- lib/cucumber/formatter/unicode.rb
|
414
426
|
- lib/cucumber/formatter/usage.rb
|
415
427
|
- lib/cucumber/formatters/unicode.rb
|
416
|
-
- lib/cucumber/language_support
|
428
|
+
- lib/cucumber/language_support.rb
|
417
429
|
- lib/cucumber/language_support/language_methods.rb
|
418
430
|
- lib/cucumber/language_support/step_definition_methods.rb
|
419
431
|
- lib/cucumber/languages.yml
|
@@ -426,6 +438,9 @@ files:
|
|
426
438
|
- lib/cucumber/parser/table.tt
|
427
439
|
- lib/cucumber/parser/treetop_ext.rb
|
428
440
|
- lib/cucumber/platform.rb
|
441
|
+
- lib/cucumber/py_support/py_dsl.py
|
442
|
+
- lib/cucumber/py_support/py_language.py
|
443
|
+
- lib/cucumber/py_support/py_language.rb
|
429
444
|
- lib/cucumber/rails/rspec.rb
|
430
445
|
- lib/cucumber/rails/world.rb
|
431
446
|
- lib/cucumber/rake/task.rb
|
@@ -433,13 +448,13 @@ files:
|
|
433
448
|
- lib/cucumber/rb_support/rb_hook.rb
|
434
449
|
- lib/cucumber/rb_support/rb_language.rb
|
435
450
|
- lib/cucumber/rb_support/rb_step_definition.rb
|
451
|
+
- lib/cucumber/rb_support/rb_world.rb
|
436
452
|
- lib/cucumber/rspec_neuter.rb
|
437
453
|
- lib/cucumber/step_match.rb
|
438
454
|
- lib/cucumber/step_mother.rb
|
439
455
|
- lib/cucumber/version.rb
|
440
456
|
- lib/cucumber/webrat/element_locator.rb
|
441
457
|
- lib/cucumber/webrat/table_locator.rb
|
442
|
-
- lib/cucumber/world.rb
|
443
458
|
- rails_generators/cucumber/USAGE
|
444
459
|
- rails_generators/cucumber/cucumber_generator.rb
|
445
460
|
- rails_generators/cucumber/templates/cucumber
|
@@ -465,7 +480,6 @@ files:
|
|
465
480
|
- spec/cucumber/ast/step_collection_spec.rb
|
466
481
|
- spec/cucumber/ast/step_spec.rb
|
467
482
|
- spec/cucumber/ast/table_spec.rb
|
468
|
-
- spec/cucumber/ast/visitor_spec.rb
|
469
483
|
- spec/cucumber/broadcaster_spec.rb
|
470
484
|
- spec/cucumber/cli/configuration_spec.rb
|
471
485
|
- spec/cucumber/cli/drb_client_spec.rb
|
@@ -484,8 +498,8 @@ files:
|
|
484
498
|
- spec/cucumber/rails/stubs/mini_rails.rb
|
485
499
|
- spec/cucumber/rails/stubs/test_help.rb
|
486
500
|
- spec/cucumber/rails/world_spec.rb
|
501
|
+
- spec/cucumber/rb_support/rb_step_definition_spec.rb
|
487
502
|
- spec/cucumber/sell_cucumbers.feature
|
488
|
-
- spec/cucumber/step_definition_spec.rb
|
489
503
|
- spec/cucumber/step_mother_spec.rb
|
490
504
|
- spec/cucumber/treetop_parser/empty_feature.feature
|
491
505
|
- spec/cucumber/treetop_parser/empty_scenario.feature
|
data/gem_tasks/yard.rake
DELETED
data/lib/cucumber/world.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
# All steps are run in the context of an object that extends this module
|
3
|
-
module World
|
4
|
-
class << self
|
5
|
-
def alias_adverb(adverb)
|
6
|
-
alias_method adverb, :__cucumber_invoke
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_writer :__cucumber_step_mother
|
11
|
-
|
12
|
-
# Call a step from within a step definition
|
13
|
-
def __cucumber_invoke(name, multiline_argument=nil) #:nodoc:
|
14
|
-
begin
|
15
|
-
step_match = @__cucumber_step_mother.step_match(name)
|
16
|
-
step_match.invoke(multiline_argument)
|
17
|
-
rescue Exception => e
|
18
|
-
e.nested! if Undefined === e
|
19
|
-
raise e
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Returns a Cucumber::Ast::Table for +text_or_table+, which can either
|
24
|
-
# be a String:
|
25
|
-
#
|
26
|
-
# table(%{
|
27
|
-
# | account | description | amount |
|
28
|
-
# | INT-100 | Taxi | 114 |
|
29
|
-
# | CUC-101 | Peeler | 22 |
|
30
|
-
# })
|
31
|
-
#
|
32
|
-
# or a 2D Array:
|
33
|
-
#
|
34
|
-
# table([
|
35
|
-
# %w{ account description amount },
|
36
|
-
# %w{ INT-100 Taxi 114 },
|
37
|
-
# %w{ CUC-101 Peeler 22 }
|
38
|
-
# ])
|
39
|
-
#
|
40
|
-
def table(text_or_table, file=nil, line_offset=0)
|
41
|
-
if Array === text_or_table
|
42
|
-
Ast::Table.new(text_or_table)
|
43
|
-
else
|
44
|
-
@table_parser ||= Parser::TableParser.new
|
45
|
-
@table_parser.parse_or_fail(text_or_table.strip, file, line_offset)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Output +announcement+ alongside the formatted output.
|
50
|
-
# This is an alternative to using Kernel#puts - it will display
|
51
|
-
# nicer, and in all outputs (in case you use several formatters)
|
52
|
-
#
|
53
|
-
# Beware that the output will be printed *before* the corresponding
|
54
|
-
# step. This is because the step itself will not be printed until
|
55
|
-
# after it has run, so it can be coloured according to its status.
|
56
|
-
def announce(announcement)
|
57
|
-
@__cucumber_step_mother.announce(announcement)
|
58
|
-
end
|
59
|
-
|
60
|
-
def pending(message = "TODO")
|
61
|
-
if block_given?
|
62
|
-
begin
|
63
|
-
yield
|
64
|
-
rescue Exception => e
|
65
|
-
raise Pending.new(message)
|
66
|
-
end
|
67
|
-
raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?")
|
68
|
-
else
|
69
|
-
raise Pending.new(message)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# The default implementation of Object#inspect recursively
|
74
|
-
# traverses all instance variables and invokes inspect.
|
75
|
-
# This can be time consuming if the object graph is large.
|
76
|
-
#
|
77
|
-
# This can cause unnecessary delays when certain exceptions
|
78
|
-
# occur. For example, MRI internally invokes #inspect on an
|
79
|
-
# object that raises a NoMethodError. (JRuby does not do this).
|
80
|
-
#
|
81
|
-
# A World object can have many references created by the user
|
82
|
-
# or frameworks (Rails), so to avoid long waiting times on
|
83
|
-
# such errors in World we define it to just return a simple String.
|
84
|
-
#
|
85
|
-
def inspect
|
86
|
-
sprintf("#<%s:0x%x>", self.class, self.object_id)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
require 'cucumber/step_mother'
|
3
|
-
require 'cucumber/ast'
|
4
|
-
|
5
|
-
module Cucumber
|
6
|
-
module Ast
|
7
|
-
describe Visitor do
|
8
|
-
|
9
|
-
it "should support checking scenario name matches regexps" do
|
10
|
-
visitor = Visitor.new(mock("step mother"))
|
11
|
-
scenario = Scenario.new(background=nil,
|
12
|
-
comment=Comment.new(""),
|
13
|
-
tags=Tags.new(0, []),
|
14
|
-
line=99,
|
15
|
-
keyword="",
|
16
|
-
name="test name",
|
17
|
-
steps=[])
|
18
|
-
|
19
|
-
visitor.options = {:name_regexps => [/name/]}
|
20
|
-
|
21
|
-
visitor.matches_scenario_names?(scenario).should be_true
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
@@ -1,102 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
require 'cucumber/ast'
|
4
|
-
require 'cucumber/step_mother'
|
5
|
-
require 'cucumber/rb_support/rb_language'
|
6
|
-
|
7
|
-
module Cucumber
|
8
|
-
describe RbStepDefinition do
|
9
|
-
before do
|
10
|
-
@step_mother = StepMother.new
|
11
|
-
@step_mother.load_natural_language('en')
|
12
|
-
@rb = @step_mother.load_programming_language('rb')
|
13
|
-
@dsl = Object.new
|
14
|
-
@dsl.extend RbSupport::RbDsl
|
15
|
-
@step_mother.begin_scenario
|
16
|
-
|
17
|
-
$inside = nil
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should allow calling of other steps" do
|
21
|
-
@dsl.Given /Outside/ do
|
22
|
-
Given "Inside"
|
23
|
-
end
|
24
|
-
@dsl.Given /Inside/ do
|
25
|
-
$inside = true
|
26
|
-
end
|
27
|
-
|
28
|
-
@step_mother.step_match("Outside").invoke(nil)
|
29
|
-
$inside.should == true
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should allow calling of other steps with inline arg" do
|
33
|
-
@dsl.Given /Outside/ do
|
34
|
-
Given "Inside", Ast::Table.new([['inside']])
|
35
|
-
end
|
36
|
-
@dsl.Given /Inside/ do |table|
|
37
|
-
$inside = table.raw[0][0]
|
38
|
-
end
|
39
|
-
|
40
|
-
@step_mother.step_match("Outside").invoke(nil)
|
41
|
-
$inside.should == 'inside'
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should raise Undefined when inside step is not defined" do
|
45
|
-
@dsl.Given /Outside/ do
|
46
|
-
Given 'Inside'
|
47
|
-
end
|
48
|
-
|
49
|
-
lambda do
|
50
|
-
@step_mother.step_match('Outside').invoke(nil)
|
51
|
-
end.should raise_error(Undefined, 'Undefined step: "Inside"')
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should allow forced pending" do
|
55
|
-
@dsl.Given /Outside/ do
|
56
|
-
pending("Do me!")
|
57
|
-
end
|
58
|
-
|
59
|
-
lambda do
|
60
|
-
@step_mother.step_match("Outside").invoke(nil)
|
61
|
-
end.should raise_error(Pending, "Do me!")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should allow announce" do
|
65
|
-
v = mock('visitor')
|
66
|
-
v.should_receive(:announce).with('wasup')
|
67
|
-
@step_mother.visitor = v
|
68
|
-
@dsl.Given /Loud/ do
|
69
|
-
announce 'wasup'
|
70
|
-
end
|
71
|
-
@step_mother.step_match("Loud").invoke(nil)
|
72
|
-
end
|
73
|
-
|
74
|
-
def unindented(s)
|
75
|
-
s.split("\n")[1..-2].join("\n").indent(-8)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should recognise quotes in name and make according regexp" do
|
79
|
-
@rb.snippet_text('Given', 'A "first" arg').should == unindented(%{
|
80
|
-
Given /^A "([^\\"]*)" arg$/ do |arg1|
|
81
|
-
pending
|
82
|
-
end
|
83
|
-
})
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should recognise several quoted words in name and make according regexp and args" do
|
87
|
-
@rb.snippet_text('Given', 'A "first" and "second" arg').should == unindented(%{
|
88
|
-
Given /^A "([^\\"]*)" and "([^\\"]*)" arg$/ do |arg1, arg2|
|
89
|
-
pending
|
90
|
-
end
|
91
|
-
})
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should not use quote group when there are no quotes" do
|
95
|
-
@rb.snippet_text('Given', 'A first arg').should == unindented(%{
|
96
|
-
Given /^A first arg$/ do
|
97
|
-
pending
|
98
|
-
end
|
99
|
-
})
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|