From 89259a01da122060f34ca247e29d69b3e064e905 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 21 Mar 2012 08:51:11 -0400 Subject: [PATCH] Revert "first pass to fix issue #13 -- pass through IO-type objects that can't be IO#read properly (because they are too large?)" This reverts commit cff91ce31c87c001c8cbbd171fc84c28585ec4ec -- turns out rest-client suffers from the same ruby feature, so this trickery doesn't actually buy us anything after all? --- lib/rubydora/datastream.rb | 5 +---- spec/lib/datastream_spec.rb | 10 ---------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/rubydora/datastream.rb b/lib/rubydora/datastream.rb index aa8030f..30ebf26 100644 --- a/lib/rubydora/datastream.rb +++ b/lib/rubydora/datastream.rb @@ -118,10 +118,7 @@ def content rescue RestClient::ResourceNotFound end - if @content.kind_of? IO - content = @content.read and @content.rewind rescue nil - end - + content = @content.read and @content.rewind if @content.kind_of? IO content ||= @content end alias_method :read, :content diff --git a/spec/lib/datastream_spec.rb b/spec/lib/datastream_spec.rb index 4265658..b5f977f 100644 --- a/spec/lib/datastream_spec.rb +++ b/spec/lib/datastream_spec.rb @@ -152,16 +152,6 @@ end - it "should pass-through IO-type content if reading the content fails" do - @mock_io = File.open('rubydora.gemspec') - @mock_io.should_receive(:read).and_raise('Rubydora #13-style read-error.') - - @datastream.content = @mock_io - - @datastream.content.should == @mock_io - - end - end