Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 0a542e50a3
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (25 sloc) 0.855 kb
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), "spec_helper")
require 'spec'
require 'irb'
require File.join(File.dirname(__FILE__), '..', 'lib', 'utility_belt', 'convertable_to_file')
describe ConvertableToFile do
include ConvertableToFile
before :each do
@tempfile = stub("temp file", :<< => nil, :path => nil)
Tempfile.stub!(:open).and_yield(@tempfile)
end
it "should create a temp file using object id as basename" do
should_receive(:object_id).and_return(6789)
Tempfile.should_receive(:open).with("6789").and_yield(@tempfile)
to_file
end
it "should dump self to the opened temp file" do
@tempfile.should_receive(:<<).with(self)
to_file
end
it "should return the temp file path" do
@tempfile.should_receive(:path).and_return("TEMP_PATH")
to_file.should == "TEMP_PATH"
end
end
Jump to Line
Something went wrong with that request. Please try again.