Skip to content

Commit

Permalink
Features written using Ruby where breaking due to missing a line number
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Wilk committed Nov 15, 2008
1 parent 361e278 commit 1670682
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Blurb
* Try to load webrat gem if it's not installed as a plugin (Aslak Hellesøy)

=== Bugfixes
* Features written using Ruby where breaking due to missing a line number (#91 Joseph Wilk)

=== Removed features
* Step definition without a block being treated as pending (#64 Joseph Wilk)
Expand Down
3 changes: 2 additions & 1 deletion lib/cucumber/tree/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def padding_length
end

def Scenario(name, &proc)
add_scenario(name, &proc)
_, line, _ = *caller[0].split(':')
add_scenario(name, line, &proc)
end

def Table(matrix = [], &proc)
Expand Down
10 changes: 10 additions & 0 deletions spec/cucumber/tree/feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
module Cucumber
module Tree
describe Feature do

it "should have padding_length 2 when alone" do
feature = Feature.new('header')
feature.padding_length.should == 2
end

it "should create a new scenario for a feature" do
feature = Feature.new('header')

Scenario.should_receive(:new).with(feature, 'test scenario', "17")

feature.Scenario('test scenario') {}
end

end
end
end

0 comments on commit 1670682

Please sign in to comment.