Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: dcabfb7753
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (26 sloc) 0.734 kb
require File.join(File.dirname(__FILE__), '/spec_helper')
require 'tempfile'
describe Gopher::Response do
before(:each) do
@response = Gopher::Response.new
end
it "gets size for string results" do
@response.body = "hi"
@response.size.should == 2
end
it "gets size for stringio results" do
@response.body = StringIO.new("12345")
@response.size.should == 5
end
it "defaults to 0 size for weird objects" do
@response.body = mock(Object)
@response.size.should == 0
end
it "gets size for file results" do
temp_file = Tempfile.new('result')
temp_file.write("1234567890")
temp_file.flush
@response.body = File.new(temp_file.path)
@response.size.should == 10
end
end
Jump to Line
Something went wrong with that request. Please try again.