Skip to content

Commit

Permalink
Correct implementation of Cucumber::Formatter::Interceptor::Pipe#resp…
Browse files Browse the repository at this point in the history
…ond_to?. Fixes #312
  • Loading branch information
os97673 committed Apr 16, 2013
1 parent 935c6a3 commit 4839510
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion History.md
Expand Up @@ -13,7 +13,7 @@
* Improve rake task report on failure ([#400](https://github.com/cucumber/cucumber/issues/400) Andrey Vakarev
* Show details of nested steps in backtraces
([#69](https://github.com/cucumber/cucumber/issues/69)) Steve Tooke
* Filter out control characters from CDATA section of JUnit formatter output.
* Filter out control characters from CDATA section of JUnit formatter output.
([#383](https://github.com/cucumber/cucumber/issues/383) @teacup-on-rockingchair)
* Fix problem with non-ascii characters in file path
([#150](https://github.com/cucumber/cucumber/issues/150) Oleg Sukhodolsky)
Expand All @@ -29,6 +29,8 @@
([#337](https://github.com/cucumber/cucumber/issues/337) Oleg Sukhodolsky)
* Allow duplication for format+output pair in command line
([#434](https://github.com/cucumber/cucumber/issues/434) David Lantos)
* Better delegation to IO in Cucumber::Formatter::Interceptor::Pipe
([#312](https://github.com/cucumber/cucumber/issues/312) Oleg Sukhodolsky)

## [1.2.5](https://github.com/cucumber/cucumber/compare/v1.2.3...v1.2.5)

Expand Down
4 changes: 4 additions & 0 deletions lib/cucumber/formatter/interceptor.rb
Expand Up @@ -24,6 +24,10 @@ def method_missing(method, *args, &blk)
@pipe.send(method, *args, &blk)
end

def respond_to?(method, include_private=false)
super || @pipe.respond_to?(method, include_private)
end

def self.validate_pipe(pipe)
unless [:stdout, :stderr].include? pipe
raise ArgumentError, '#wrap only accepts :stderr or :stdout'
Expand Down
8 changes: 8 additions & 0 deletions spec/cucumber/formatter/interceptor_spec.rb
Expand Up @@ -117,5 +117,13 @@ module Cucumber::Formatter
pi.tty?.should be true
end
end

describe '#respond_to' do
let(:pi) { Interceptor::Pipe.wrap(:stderr) }

it 'should respond to all methods $stderr has' do
$stderr.methods.each { |m| pi.respond_to?(m).should be true }
end
end
end
end

0 comments on commit 4839510

Please sign in to comment.