Skip to content

Commit

Permalink
Fix the Pretty formatters printing of AfterStep hook output in Backgr…
Browse files Browse the repository at this point in the history
…ound
  • Loading branch information
brasmusson committed Sep 18, 2014
1 parent 9f72b55 commit 4ebd6e3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/cucumber/formatter/pretty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def before_background(background)
end

def after_background(background)
print_messages
@in_background = nil
@io.puts
@io.flush
Expand Down
44 changes: 43 additions & 1 deletion spec/cucumber/formatter/pretty_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ module Formatter
end
end

describe "with a output from hooks" do
describe "with output from hooks" do
define_feature <<-FEATURE
Feature:
Scenario:
Expand Down Expand Up @@ -311,6 +311,48 @@ module Formatter
2 scenarios (2 passed)
2 steps (2 passed)
OUTPUT
end
end

describe "with background and output from hooks" do
define_feature <<-FEATURE
Feature:
Background:
Given this step passes
Scenario:
Given this step passes
FEATURE

define_steps do
Before do
puts "Before hook"
end
AfterStep do
puts "AfterStep hook"
end
After do
puts "After hook"
end
Given(/^this step passes$/) {}
end

it "displays hook output appropriately " do
expect( @out.string ).to include <<OUTPUT
Feature:
Background:
Before hook
Given this step passes
AfterStep hook
Scenario:
Given this step passes
AfterStep hook
After hook
1 scenario (1 passed)
2 steps (2 passed)
OUTPUT
end
end
Expand Down

0 comments on commit 4ebd6e3

Please sign in to comment.