Skip to content
3 changes: 1 addition & 2 deletions lib/cucumber/core/ast/step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Step #:nodoc:
include HasLocation
include DescribesItself

attr_reader :keyword, :name, :language
attr_accessor :exception, :multiline_arg
attr_reader :keyword, :name, :language, :exception, :multiline_arg

def initialize(language, location, keyword, name, multiline_arg=nil)
@location, @keyword, @name, @multiline_arg = location, keyword, name, multiline_arg
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/core/test/case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def inspect
private

def compose_around_hooks(visitor, *args, &block)
around_hooks.reduce(block) do |continue, hook|
around_hooks.reverse.reduce(block) do |continue, hook|
-> { hook.describe_to(visitor, *args, &continue) }
end.call
end
Expand Down
11 changes: 11 additions & 0 deletions spec/cucumber/core/test/case_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,24 @@ module Test
test_case.describe_to(visitor, args)
end

it "describes around hooks in order" do
visitor = double
visitor.stub(:test_case).and_yield
first_hook, second_hook = double, double
first_hook.should_receive(:describe_to).ordered.and_yield
second_hook.should_receive(:describe_to).ordered.and_yield
around_hooks = [first_hook, second_hook]
Test::Case.new([], [], around_hooks).describe_to(visitor, double)
end

it "describes its source to a visitor" do
visitor = double
args = double
feature.should_receive(:describe_to).with(visitor, args)
scenario.should_receive(:describe_to).with(visitor, args)
test_case.describe_source_to(visitor, args)
end

end

describe "#name" do
Expand Down
10 changes: 5 additions & 5 deletions spec/cucumber/core_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module Cucumber
it "filters out test cases based on a tag expression" do
visitor = double.as_null_object
visitor.should_receive(:test_case) do |test_case|
test_case.name.should eq 'foo, bar (row 1)'
test_case.name.should eq 'Scenario Outline: foo, bar (row 1)'
end.exactly(1).times

gherkin = gherkin do
Expand Down Expand Up @@ -155,10 +155,10 @@ class HookTestMappings

def test_case(test_case, mapper)
case test_case.name
when 'fail before'
when /fail before/
mapper.before { raise Failure }
mapper.after { 'This hook will be skipped' }
when 'fail after'
when /fail after/
mapper.after { raise Failure }
end
self
Expand Down Expand Up @@ -191,11 +191,11 @@ def test_step(step, mapper)

execute [gherkin], mappings, report

report.test_steps.total.should eq(6)
report.test_steps.total_failed.should eq(2)
report.test_cases.total.should eq(3)
report.test_cases.total_passed.should eq(1)
report.test_cases.total_failed.should eq(2)
report.test_steps.total.should eq(6)
report.test_steps.total_failed.should eq(2)
end
end

Expand Down