gherkin 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.13 (2010-04-18)
2
+
3
+ === New Features
4
+ * Filter on Background name. (Aslak Hellesøy)
5
+
1
6
  == 1.0.12 (2010-04-18)
2
7
 
3
8
  === Bugfixes
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 0
4
4
  :build:
5
- :patch: 12
5
+ :patch: 13
@@ -9,11 +9,11 @@ module Gherkin
9
9
  java_impl('gherkin.jar')
10
10
 
11
11
  # Creates a new instance that replays events to +listener+, filtered by +filters+,
12
- # a Hash that can contain:
12
+ # an Array that can contain one of the following:
13
13
  #
14
- # * <tt>:lines</tt> An Array of line numbers to filter on.
15
- # * <tt>:name_regexen</tt> An Array of name regexen to filter on. Matches against :feature, :scenario, :scenario_outline and :examples
16
- # * <tt>:tag_expression</tt> A TagExpression to filter on.
14
+ # * Line numbers (Fixnum) to filter on.
15
+ # * Name regexen (Regexp) to filter on. Matches against :feature, :background, :scenario, :scenario_outline and :examples
16
+ # * Tag expressions (String) to filter on.
17
17
  #
18
18
  def initialize(listener, filters)
19
19
  @listener = listener
@@ -55,7 +55,7 @@ module Gherkin
55
55
  @feature_buffer << sexp
56
56
  @meta_buffer = []
57
57
  @table_state = :background
58
- @feature_ok = true if filter_match?(sexp)
58
+ @background_ok = true if filter_match?(sexp)
59
59
  when :scenario
60
60
  replay_examples_rows_buffer
61
61
  @scenario_buffer = @meta_buffer
@@ -65,6 +65,7 @@ module Gherkin
65
65
  @meta_buffer = []
66
66
  @scenario_ok = filter_match?(*@scenario_buffer) || tag_match?
67
67
  @examples_ok = false
68
+ @background_ok = false
68
69
  @table_state = :step
69
70
  when :scenario_outline
70
71
  replay_examples_rows_buffer
@@ -75,6 +76,7 @@ module Gherkin
75
76
  @meta_buffer = []
76
77
  @scenario_ok = filter_match?(*@scenario_buffer)
77
78
  @examples_ok = false
79
+ @background_ok = false
78
80
  @table_state = :step
79
81
  when :examples
80
82
  replay_examples_rows_buffer
@@ -91,7 +93,7 @@ module Gherkin
91
93
  @feature_buffer += @meta_buffer
92
94
  @feature_buffer << sexp
93
95
  @meta_buffer = []
94
- @feature_ok = true if filter_match?(sexp)
96
+ @background_ok = true if filter_match?(sexp)
95
97
  else
96
98
  @scenario_buffer << sexp
97
99
  @scenario_ok ||= filter_match?(*@scenario_buffer)
@@ -132,7 +134,7 @@ module Gherkin
132
134
  super
133
135
  end
134
136
 
135
- if @scenario_ok || @examples_ok || @feature_ok
137
+ if @scenario_ok || @examples_ok || @feature_ok || @background_ok
136
138
  replay_buffers
137
139
  end
138
140
  end
@@ -19,7 +19,7 @@ module Gherkin
19
19
  end
20
20
 
21
21
  def name_match?(name_regexen)
22
- return false unless [:feature, :scenario, :scenario_outline, :examples].include?(event)
22
+ return false unless [:feature, :background, :scenario, :scenario_outline, :examples].include?(event)
23
23
  name_regexen.detect{|name_regex| name =~ name_regex}
24
24
  end
25
25
 
@@ -180,12 +180,12 @@ Feature: 2
180
180
  verify_filters([1,2,3,4,5,7,8,9,10,12,13,14,15,16,:eof], [])
181
181
  end
182
182
 
183
- it "should replay identically when filtering on the line of a background step" do
184
- verify_filters([1,2,3,4,5,7,8,9,10,12,13,14,15,16,:eof], [5])
183
+ it "should not replay any scenarios when filtering on the line of a background step" do
184
+ verify_filters([1,2,3,4,5,:eof], [5])
185
185
  end
186
186
 
187
- it "should replay identically when filtering on the line of the background" do
188
- verify_filters([1,2,3,4,5,7,8,9,10,12,13,14,15,16,:eof], [4])
187
+ it "should not replay any scenarios when filtering on the line of the background" do
188
+ verify_filters([1,2,3,4,5,:eof], [4])
189
189
  end
190
190
 
191
191
  it "should replay the background on step line of first scenario" do
@@ -358,7 +358,7 @@ Feature: 3
358
358
  end
359
359
 
360
360
  context "Background with PyString" do
361
- it "should replay itself properly" do
361
+ before do
362
362
  @input = %{#language:en
363
363
  Feature: 2
364
364
  Background: 3
@@ -379,7 +379,9 @@ Feature: 2
379
379
  18
380
380
  """
381
381
  }
382
+ end
382
383
 
384
+ it "should replay itself properly" do
383
385
  verify_filters([1,2,3,4,5,15,16,17,:eof], [15])
384
386
  end
385
387
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 12
9
- version: 1.0.12
8
+ - 13
9
+ version: 1.0.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mike Sassak