cucumber 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/History.txt +27 -0
  2. data/VERSION.yml +3 -2
  3. data/cucumber.gemspec +11 -5
  4. data/examples/watir/features/support/screenshots.rb +1 -2
  5. data/features/call_many_steps.feature +124 -0
  6. data/features/default_snippets.feature +2 -2
  7. data/features/expand.feature +13 -2
  8. data/features/language_help.feature +1 -1
  9. data/features/report_called_undefined_steps.feature +1 -1
  10. data/features/snippet.feature +2 -2
  11. data/features/support/env.rb +3 -5
  12. data/features/tag_logic.feature +32 -0
  13. data/features/wire_protocol.feature +7 -7
  14. data/lib/cucumber.rb +6 -0
  15. data/lib/cucumber/ast/background.rb +1 -1
  16. data/lib/cucumber/ast/comment.rb +1 -1
  17. data/lib/cucumber/ast/examples.rb +1 -1
  18. data/lib/cucumber/ast/feature.rb +1 -1
  19. data/lib/cucumber/ast/feature_element.rb +2 -3
  20. data/lib/cucumber/ast/features.rb +1 -1
  21. data/lib/cucumber/ast/outline_table.rb +17 -4
  22. data/lib/cucumber/ast/py_string.rb +3 -1
  23. data/lib/cucumber/ast/scenario.rb +3 -1
  24. data/lib/cucumber/ast/scenario_outline.rb +2 -2
  25. data/lib/cucumber/ast/step.rb +1 -1
  26. data/lib/cucumber/ast/step_collection.rb +1 -1
  27. data/lib/cucumber/ast/step_invocation.rb +2 -1
  28. data/lib/cucumber/ast/table.rb +3 -3
  29. data/lib/cucumber/ast/tags.rb +18 -11
  30. data/lib/cucumber/ast/tree_walker.rb +16 -0
  31. data/lib/cucumber/cli/main.rb +3 -2
  32. data/lib/cucumber/cli/options.rb +4 -6
  33. data/lib/cucumber/cli/profile_loader.rb +4 -0
  34. data/lib/cucumber/filter.rb +2 -2
  35. data/lib/cucumber/formatter/ansicolor.rb +8 -0
  36. data/lib/cucumber/formatter/pretty.rb +3 -4
  37. data/lib/cucumber/language_support/language_methods.rb +4 -3
  38. data/lib/cucumber/languages.yml +1 -1
  39. data/lib/cucumber/parser.rb +2 -0
  40. data/lib/cucumber/parser/common.rb +170 -0
  41. data/lib/cucumber/parser/common.tt +21 -0
  42. data/lib/cucumber/parser/feature.rb +7 -291
  43. data/lib/cucumber/parser/feature.tt +7 -43
  44. data/lib/cucumber/parser/i18n.tt +2 -0
  45. data/lib/cucumber/parser/natural_language.rb +9 -0
  46. data/lib/cucumber/parser/py_string.rb +276 -0
  47. data/lib/cucumber/parser/py_string.tt +45 -0
  48. data/lib/cucumber/parser/table.rb +5 -120
  49. data/lib/cucumber/parser/table.tt +2 -13
  50. data/lib/cucumber/platform.rb +3 -2
  51. data/lib/cucumber/rails/active_record.rb +2 -21
  52. data/lib/cucumber/rails/world.rb +2 -1
  53. data/lib/cucumber/rb_support/rb_hook.rb +2 -1
  54. data/lib/cucumber/rb_support/rb_language.rb +8 -6
  55. data/lib/cucumber/rb_support/rb_step_definition.rb +4 -0
  56. data/lib/cucumber/rb_support/rb_world.rb +16 -37
  57. data/lib/cucumber/step_mother.rb +86 -2
  58. data/lib/cucumber/wire_support/wire_language.rb +2 -2
  59. data/lib/cucumber/wire_support/wire_protocol.rb +1 -1
  60. data/rails_generators/cucumber/cucumber_generator.rb +3 -1
  61. data/rails_generators/cucumber/templates/cucumber.rake +4 -2
  62. data/rails_generators/cucumber/templates/webrat_steps.rb +28 -28
  63. data/spec/cucumber/ast/background_spec.rb +2 -1
  64. data/spec/cucumber/ast/scenario_spec.rb +3 -1
  65. data/spec/cucumber/formatter/console_spec.rb +1 -1
  66. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +14 -5
  67. data/spec/cucumber/step_mother_spec.rb +1 -1
  68. data/spec/cucumber/world/pending_spec.rb +1 -1
  69. metadata +8 -3
@@ -7,9 +7,9 @@ module Cucumber
7
7
  def create_step_match(step_definition, step_name, name_to_report, step_arguments)
8
8
  StepMatch.new(step_definition, step_name, name_to_report, step_arguments)
9
9
  end
10
-
10
+
11
11
  def before(scenario)
12
- begin_scenario
12
+ begin_scenario(scenario)
13
13
  execute_before(scenario)
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ module Cucumber
17
17
  execute_after(scenario)
18
18
  end_scenario
19
19
  end
20
-
20
+
21
21
  def after_configuration(configuration)
22
22
  hooks[:after_configuration].each do |hook|
23
23
  hook.invoke('AfterConfiguration', configuration)
@@ -38,6 +38,7 @@ module Cucumber
38
38
  end
39
39
 
40
40
  def add_hook(phase, hook)
41
+ hook.tag_name_lists = hook.tag_names.map {|tag_string| Ast::Tags.parse_tags(tag_string)}
41
42
  hooks[phase.to_sym] << hook
42
43
  hook
43
44
  end
@@ -86,7 +86,7 @@
86
86
  and: A
87
87
  but: Ond
88
88
  space_after_keyword: true
89
- "cz":
89
+ "cs":
90
90
  name: Czech
91
91
  native: Česky
92
92
  encoding: UTF-8
@@ -2,5 +2,7 @@ require 'erb'
2
2
  require 'cucumber/platform'
3
3
  require 'cucumber/ast'
4
4
  require 'cucumber/parser/treetop_ext'
5
+ require 'cucumber/parser/common'
5
6
  require 'cucumber/parser/table'
7
+ require 'cucumber/parser/py_string'
6
8
  require 'cucumber/parser/feature'
@@ -0,0 +1,170 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Cucumber
5
+ module Parser
6
+ module Common
7
+ include Treetop::Runtime
8
+
9
+ def root
10
+ @root || :white
11
+ end
12
+
13
+ def _nt_white
14
+ start_index = index
15
+ if node_cache[:white].has_key?(index)
16
+ cached = node_cache[:white][index]
17
+ @index = cached.interval.end if cached
18
+ return cached
19
+ end
20
+
21
+ s0, i0 = [], index
22
+ loop do
23
+ i1 = index
24
+ r2 = _nt_space
25
+ if r2
26
+ r1 = r2
27
+ else
28
+ r3 = _nt_eol
29
+ if r3
30
+ r1 = r3
31
+ else
32
+ @index = i1
33
+ r1 = nil
34
+ end
35
+ end
36
+ if r1
37
+ s0 << r1
38
+ else
39
+ break
40
+ end
41
+ end
42
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
43
+
44
+ node_cache[:white][start_index] = r0
45
+
46
+ r0
47
+ end
48
+
49
+ def _nt_space
50
+ start_index = index
51
+ if node_cache[:space].has_key?(index)
52
+ cached = node_cache[:space][index]
53
+ @index = cached.interval.end if cached
54
+ return cached
55
+ end
56
+
57
+ if has_terminal?('\G[ \\t]', true, index)
58
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
59
+ @index += 1
60
+ else
61
+ r0 = nil
62
+ end
63
+
64
+ node_cache[:space][start_index] = r0
65
+
66
+ r0
67
+ end
68
+
69
+ module Eol0
70
+ end
71
+
72
+ def _nt_eol
73
+ start_index = index
74
+ if node_cache[:eol].has_key?(index)
75
+ cached = node_cache[:eol][index]
76
+ @index = cached.interval.end if cached
77
+ return cached
78
+ end
79
+
80
+ i0 = index
81
+ if has_terminal?("\n", false, index)
82
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
83
+ @index += 1
84
+ else
85
+ terminal_parse_failure("\n")
86
+ r1 = nil
87
+ end
88
+ if r1
89
+ r0 = r1
90
+ else
91
+ i2, s2 = index, []
92
+ if has_terminal?("\r", false, index)
93
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
94
+ @index += 1
95
+ else
96
+ terminal_parse_failure("\r")
97
+ r3 = nil
98
+ end
99
+ s2 << r3
100
+ if r3
101
+ if has_terminal?("\n", false, index)
102
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
103
+ @index += 1
104
+ else
105
+ terminal_parse_failure("\n")
106
+ r5 = nil
107
+ end
108
+ if r5
109
+ r4 = r5
110
+ else
111
+ r4 = instantiate_node(SyntaxNode,input, index...index)
112
+ end
113
+ s2 << r4
114
+ end
115
+ if s2.last
116
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
117
+ r2.extend(Eol0)
118
+ else
119
+ @index = i2
120
+ r2 = nil
121
+ end
122
+ if r2
123
+ r0 = r2
124
+ else
125
+ @index = i0
126
+ r0 = nil
127
+ end
128
+ end
129
+
130
+ node_cache[:eol][start_index] = r0
131
+
132
+ r0
133
+ end
134
+
135
+ def _nt_eof
136
+ start_index = index
137
+ if node_cache[:eof].has_key?(index)
138
+ cached = node_cache[:eof][index]
139
+ @index = cached.interval.end if cached
140
+ return cached
141
+ end
142
+
143
+ i0 = index
144
+ if index < input_length
145
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
146
+ @index += 1
147
+ else
148
+ terminal_parse_failure("any character")
149
+ r1 = nil
150
+ end
151
+ if r1
152
+ r0 = nil
153
+ else
154
+ @index = i0
155
+ r0 = instantiate_node(SyntaxNode,input, index...index)
156
+ end
157
+
158
+ node_cache[:eof][start_index] = r0
159
+
160
+ r0
161
+ end
162
+
163
+ end
164
+
165
+ class CommonParser < Treetop::Runtime::CompiledParser
166
+ include Common
167
+ end
168
+
169
+ end
170
+ end
@@ -0,0 +1,21 @@
1
+ module Cucumber
2
+ module Parser
3
+ grammar Common
4
+ rule white
5
+ (space / eol)*
6
+ end
7
+
8
+ rule space
9
+ [ \t]
10
+ end
11
+
12
+ rule eol
13
+ "\n" / ("\r" "\n"?)
14
+ end
15
+
16
+ rule eof
17
+ !.
18
+ end
19
+ end
20
+ end
21
+ end
@@ -491,8 +491,8 @@ module Cucumber
491
491
  steps.at_line?(line)
492
492
  end
493
493
 
494
- def matches_tags?(tag_names)
495
- Ast::Tags.matches?(self.parent.tags.tag_names, tag_names)
494
+ def matches_tags?(tag_name_lists)
495
+ Ast::Tags.matches?(self.parent.tags.tag_names, tag_name_lists)
496
496
  end
497
497
 
498
498
  def build
@@ -687,10 +687,10 @@ module Cucumber
687
687
  tags.at_line?(line)
688
688
  end
689
689
 
690
- def matches_tags?(tag_names)
690
+ def matches_tags?(tag_name_lists)
691
691
  feature_tag_names = self.parent.parent.tags.tag_names
692
692
  source_tag_names = (feature_tag_names + tags.tag_names).uniq
693
- Ast::Tags.matches?(source_tag_names, tag_names)
693
+ Ast::Tags.matches?(source_tag_names, tag_name_lists)
694
694
  end
695
695
 
696
696
  def matches_name?(regexp_to_match)
@@ -826,10 +826,10 @@ module Cucumber
826
826
  steps.at_line?(line)
827
827
  end
828
828
 
829
- def matches_tags?(tag_names)
829
+ def matches_tags?(tag_name_lists)
830
830
  feature_tag_names = self.parent.parent.tags.tag_names
831
831
  source_tag_names = (feature_tag_names + tags.tag_names).uniq
832
- Ast::Tags.matches?(source_tag_names, tag_names)
832
+ Ast::Tags.matches?(source_tag_names, tag_name_lists)
833
833
  end
834
834
 
835
835
  def matches_name?(regexp_to_match)
@@ -1168,7 +1168,7 @@ module Cucumber
1168
1168
  table.at_line?(line)
1169
1169
  end
1170
1170
 
1171
- def matches_tags?(tag_names)
1171
+ def matches_tags?(tag_name_lists)
1172
1172
  true
1173
1173
  end
1174
1174
 
@@ -1507,290 +1507,6 @@ module Cucumber
1507
1507
  r0
1508
1508
  end
1509
1509
 
1510
- module PyString0
1511
- end
1512
-
1513
- module PyString1
1514
- def open_py_string
1515
- elements[0]
1516
- end
1517
-
1518
- def s
1519
- elements[1]
1520
- end
1521
-
1522
- def close_py_string
1523
- elements[2]
1524
- end
1525
- end
1526
-
1527
- module PyString2
1528
- def at_line?(line)
1529
- line >= open_py_string.line && line <= close_py_string.line
1530
- end
1531
-
1532
- def build
1533
- Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
1534
- end
1535
- end
1536
-
1537
- def _nt_py_string
1538
- start_index = index
1539
- if node_cache[:py_string].has_key?(index)
1540
- cached = node_cache[:py_string][index]
1541
- @index = cached.interval.end if cached
1542
- return cached
1543
- end
1544
-
1545
- i0, s0 = index, []
1546
- r1 = _nt_open_py_string
1547
- s0 << r1
1548
- if r1
1549
- s2, i2 = [], index
1550
- loop do
1551
- i3, s3 = index, []
1552
- i4 = index
1553
- r5 = _nt_close_py_string
1554
- if r5
1555
- r4 = nil
1556
- else
1557
- @index = i4
1558
- r4 = instantiate_node(SyntaxNode,input, index...index)
1559
- end
1560
- s3 << r4
1561
- if r4
1562
- if index < input_length
1563
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
1564
- @index += 1
1565
- else
1566
- terminal_parse_failure("any character")
1567
- r6 = nil
1568
- end
1569
- s3 << r6
1570
- end
1571
- if s3.last
1572
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1573
- r3.extend(PyString0)
1574
- else
1575
- @index = i3
1576
- r3 = nil
1577
- end
1578
- if r3
1579
- s2 << r3
1580
- else
1581
- break
1582
- end
1583
- end
1584
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1585
- s0 << r2
1586
- if r2
1587
- r7 = _nt_close_py_string
1588
- s0 << r7
1589
- end
1590
- end
1591
- if s0.last
1592
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1593
- r0.extend(PyString1)
1594
- r0.extend(PyString2)
1595
- else
1596
- @index = i0
1597
- r0 = nil
1598
- end
1599
-
1600
- node_cache[:py_string][start_index] = r0
1601
-
1602
- r0
1603
- end
1604
-
1605
- module OpenPyString0
1606
- def indent
1607
- elements[0]
1608
- end
1609
-
1610
- def eol
1611
- elements[3]
1612
- end
1613
- end
1614
-
1615
- module OpenPyString1
1616
- def indentation
1617
- indent.text_value.length
1618
- end
1619
-
1620
- def line
1621
- indent.line
1622
- end
1623
- end
1624
-
1625
- def _nt_open_py_string
1626
- start_index = index
1627
- if node_cache[:open_py_string].has_key?(index)
1628
- cached = node_cache[:open_py_string][index]
1629
- @index = cached.interval.end if cached
1630
- return cached
1631
- end
1632
-
1633
- i0, s0 = index, []
1634
- s1, i1 = [], index
1635
- loop do
1636
- r2 = _nt_space
1637
- if r2
1638
- s1 << r2
1639
- else
1640
- break
1641
- end
1642
- end
1643
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1644
- s0 << r1
1645
- if r1
1646
- if has_terminal?('"""', false, index)
1647
- r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
1648
- @index += 3
1649
- else
1650
- terminal_parse_failure('"""')
1651
- r3 = nil
1652
- end
1653
- s0 << r3
1654
- if r3
1655
- s4, i4 = [], index
1656
- loop do
1657
- r5 = _nt_space
1658
- if r5
1659
- s4 << r5
1660
- else
1661
- break
1662
- end
1663
- end
1664
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
1665
- s0 << r4
1666
- if r4
1667
- r6 = _nt_eol
1668
- s0 << r6
1669
- end
1670
- end
1671
- end
1672
- if s0.last
1673
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1674
- r0.extend(OpenPyString0)
1675
- r0.extend(OpenPyString1)
1676
- else
1677
- @index = i0
1678
- r0 = nil
1679
- end
1680
-
1681
- node_cache[:open_py_string][start_index] = r0
1682
-
1683
- r0
1684
- end
1685
-
1686
- module ClosePyString0
1687
- def eol
1688
- elements[0]
1689
- end
1690
-
1691
- def quotes
1692
- elements[2]
1693
- end
1694
-
1695
- def white
1696
- elements[3]
1697
- end
1698
- end
1699
-
1700
- module ClosePyString1
1701
- def line
1702
- quotes.line
1703
- end
1704
- end
1705
-
1706
- def _nt_close_py_string
1707
- start_index = index
1708
- if node_cache[:close_py_string].has_key?(index)
1709
- cached = node_cache[:close_py_string][index]
1710
- @index = cached.interval.end if cached
1711
- return cached
1712
- end
1713
-
1714
- i0, s0 = index, []
1715
- r1 = _nt_eol
1716
- s0 << r1
1717
- if r1
1718
- s2, i2 = [], index
1719
- loop do
1720
- r3 = _nt_space
1721
- if r3
1722
- s2 << r3
1723
- else
1724
- break
1725
- end
1726
- end
1727
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1728
- s0 << r2
1729
- if r2
1730
- if has_terminal?('"""', false, index)
1731
- r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
1732
- @index += 3
1733
- else
1734
- terminal_parse_failure('"""')
1735
- r4 = nil
1736
- end
1737
- s0 << r4
1738
- if r4
1739
- r5 = _nt_white
1740
- s0 << r5
1741
- end
1742
- end
1743
- end
1744
- if s0.last
1745
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1746
- r0.extend(ClosePyString0)
1747
- r0.extend(ClosePyString1)
1748
- else
1749
- @index = i0
1750
- r0 = nil
1751
- end
1752
-
1753
- node_cache[:close_py_string][start_index] = r0
1754
-
1755
- r0
1756
- end
1757
-
1758
- def _nt_white
1759
- start_index = index
1760
- if node_cache[:white].has_key?(index)
1761
- cached = node_cache[:white][index]
1762
- @index = cached.interval.end if cached
1763
- return cached
1764
- end
1765
-
1766
- s0, i0 = [], index
1767
- loop do
1768
- i1 = index
1769
- r2 = _nt_space
1770
- if r2
1771
- r1 = r2
1772
- else
1773
- r3 = _nt_eol
1774
- if r3
1775
- r1 = r3
1776
- else
1777
- @index = i1
1778
- r1 = nil
1779
- end
1780
- end
1781
- if r1
1782
- s0 << r1
1783
- else
1784
- break
1785
- end
1786
- end
1787
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1788
-
1789
- node_cache[:white][start_index] = r0
1790
-
1791
- r0
1792
- end
1793
-
1794
1510
  end
1795
1511
 
1796
1512
  class FeatureParser < Treetop::Runtime::CompiledParser