Sha256: d70b8b911645437ce720199d7b7449348c5c4a6fbb6e80e33baa2b197caeb63f
Contents?: true
Size: 855 Bytes
Versions: 13
Compression:
Stored size: 855 Bytes
Contents
#!/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
Version data entries
13 entries across 13 versions & 6 rubygems