From 1acbfb1614fb35de545e8223f99d5d757f957b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Rzepecki?= Date: Mon, 6 Oct 2014 18:43:03 +0200 Subject: [PATCH] Use io-grab to make the tests work in jenkins --- slosilo.gemspec | 1 + spec/io_helper.rb | 18 ------------------ spec/sequel_adapter_spec.rb | 6 +++--- 3 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 spec/io_helper.rb diff --git a/slosilo.gemspec b/slosilo.gemspec index e14ae10..9986a89 100644 --- a/slosilo.gemspec +++ b/slosilo.gemspec @@ -21,6 +21,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rspec', '~> 2.14' gem.add_development_dependency 'ci_reporter', '~> 1.9' gem.add_development_dependency 'simplecov' + gem.add_development_dependency 'io-grab', '~> 0.0.1' gem.add_development_dependency 'sequel' # for sequel tests gem.add_development_dependency 'sqlite3' # for sequel tests end diff --git a/spec/io_helper.rb b/spec/io_helper.rb deleted file mode 100644 index f457a7c..0000000 --- a/spec/io_helper.rb +++ /dev/null @@ -1,18 +0,0 @@ -class IO - def grab &block - @grabbed_output = "" - class << self - def write arg - @grabbed_output += arg - end - end - - begin - yield - ensure - singleton_class.send :remove_method, :write - end - - @grabbed_output - end -end diff --git a/spec/sequel_adapter_spec.rb b/spec/sequel_adapter_spec.rb index 787c618..3555365 100644 --- a/spec/sequel_adapter_spec.rb +++ b/spec/sequel_adapter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'sequel' -require 'io_helper' +require 'io/grab' require 'slosilo/adapters/sequel_adapter' @@ -95,7 +95,7 @@ end it "supports look up by fingerprint, without a warning" do - STDERR.grab do + $stderr.grab do subject.get_by_fingerprint(key.fingerprint).should == [key, 'test'] end.should be_empty end @@ -106,7 +106,7 @@ end it "supports look up by fingerprint, but issues a warning" do - STDERR.grab do + $stderr.grab do subject.get_by_fingerprint(key.fingerprint).should == [key, 'test'] end.should_not be_empty end