Sha256: 08f0d8550e23b882da7c19740daa3954cc00d60d1a601ea88cd931c17ac87127

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

require 'helper'

class IOTest < Test::Unit::TestCase
  context "#initialize" do
    should "set attributes from hash" do
      Joint::IO.new(:name => 'foo').name.should == 'foo'
    end
  end

  should "default type to plain text" do
    Joint::IO.new.type.should == 'plain/text'
  end

  should "default size to content size" do
    content = 'This is my content'
    Joint::IO.new(:content => content).size.should == content.size
  end

  should "alias path to name" do
    Joint::IO.new(:name => 'foo').path.should == 'foo'
  end

  context "#read" do
    should "return content" do
      Joint::IO.new(:content => 'Testing').read.should == 'Testing'
    end
  end
  
  context "#rewind" do
    should "rewinds the io to position 0" do
      io = Joint::IO.new(:content => 'Testing')
      io.read.should == 'Testing'
      io.read.should == ''
      io.rewind
      io.read.should == 'Testing'
    end
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
associo-0.1.0 test/joint/test_io.rb
jamieorc-joint-0.6.2 test/joint/test_io.rb