Skip to content

Commit

Permalink
Feature which only has a Background with steps causes an exception [#306
Browse files Browse the repository at this point in the history
 state:resolved]
  • Loading branch information
aslakhellesoy committed Apr 26, 2009
1 parent 23cbc9b commit 358bac2
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ With the addition of Latvian and Hungarian Cucumber now supports 32(!!) language
* Pick up failure on after hook (#272 Aslak Hellesøy)

=== Bugfixes
* Feature which only has a Background with steps causes an exception (#306 Aslak Hellesøy)
* Gem no longer depends on Hoe (Aslak Hellesøy)
* Span html tags appear on HTML results with 0.3.0 (#299 Aslak Hellesøy)
* Fixed incorrect colours in pretty formatter's table headers for outline tables (Aslak Hellesøy)
Expand Down
1 change: 1 addition & 0 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ examples/tickets/features/272/hooks_steps.rb
examples/tickets/features/279/py_string_indent.feature
examples/tickets/features/279/py_string_indent.steps.rb
examples/tickets/features/279/wrong.feature_
examples/tickets/features/306/only_background.feature
examples/tickets/features/lib/eatting_machine.rb
examples/tickets/features/lib/pantry.rb
examples/tickets/features/scenario_outline.feature
Expand Down
4 changes: 4 additions & 0 deletions examples/tickets/features/306/only_background.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Feature: woo yeah

Background:
Given passing step without a table
1 change: 0 additions & 1 deletion lib/cucumber/ast/background.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Cucumber
module Ast
class Background
include FeatureElement
attr_writer :feature

def initialize(comment, line, keyword, name, steps)
@comment, @line, @keyword, @name, @steps = comment, line, keyword, name, StepCollection.new(steps)
Expand Down
1 change: 1 addition & 0 deletions lib/cucumber/ast/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Feature
def initialize(background, comment, tags, name, feature_elements)
@background, @comment, @tags, @name, @feature_elements = background, comment, tags, name, feature_elements

background.feature = self if background
@feature_elements.each do |feature_element|
feature_element.feature = self
end
Expand Down
2 changes: 2 additions & 0 deletions lib/cucumber/ast/feature_element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Cucumber
module FeatureElement
attr_writer :feature

def attach_steps(steps)
steps.each {|step| step.feature_element = self}
end
Expand Down
5 changes: 0 additions & 5 deletions lib/cucumber/ast/scenario.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def initialize(background, comment, tags, line, keyword, name, steps)
end
end

def feature=(feature)
@feature = feature
@background.feature = feature if @background
end

def accept(visitor)
visitor.visit_comment(@comment)
visitor.visit_tags(@tags)
Expand Down
5 changes: 0 additions & 5 deletions lib/cucumber/ast/scenario_outline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ def initialize(background, comment, tags, line, keyword, name, steps, example_se
end
end

def feature=(feature)
@feature = feature
@background.feature = feature if @background
end

def accept(visitor)
visitor.visit_comment(@comment)
visitor.visit_tags(@tags)
Expand Down

0 comments on commit 358bac2

Please sign in to comment.