Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Added rewind() method on Joint:IO. #14

Merged
merged 1 commit into from almost 2 years ago

2 participants

Jamie Orchard-Hays John Nunemaker
Jamie Orchard-Hays

Since Joint::IO's @io was updated to use a StringIO object for the content rather than just a String, we need access to the rewind method on @io. Discovered this when a bunch of my Rails tests started failing after upgrade from 0.5.x to 0.6.1.

io.rb: added rewind method to rewind @io. Recently, Joint::IO was upd…
…ated to use a StringIO object for the content rather than just a String. We need access to the rewind method on @io.
f75ecfd
John Nunemaker jnunemaker merged commit 68bd34a into from
John Nunemaker jnunemaker closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 10, 2012
io.rb: added rewind method to rewind @io. Recently, Joint::IO was upd…
…ated to use a StringIO object for the content rather than just a String. We need access to the rewind method on @io.
f75ecfd
This page is out of date. Refresh to see the latest.
4  lib/joint/io.rb
@@ -17,6 +17,10 @@ def content=(value)
17 17
     def read(*args)
18 18
       @io.read(*args)
19 19
     end
  20
+    
  21
+    def rewind
  22
+      @io.rewind if @io.respond_to?(:rewind)
  23
+    end
20 24
 
21 25
     alias path name
22 26
   end
11  test/joint/test_io.rb
@@ -25,4 +25,15 @@ class IOTest < Test::Unit::TestCase
25 25
       Joint::IO.new(:content => 'Testing').read.should == 'Testing'
26 26
     end
27 27
   end
  28
+  
  29
+  context "#rewind" do
  30
+    should "rewinds the io to position 0" do
  31
+      io = Joint::IO.new(:content => 'Testing')
  32
+      io.read.should == 'Testing'
  33
+      io.read.should == ''
  34
+      io.rewind
  35
+      io.read.should == 'Testing'
  36
+    end
  37
+  end
  38
+  
28 39
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.