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

Version Path
FreedomCoder-utility_belt-1.1.1.2 spec/convertable_to_file_spec.rb
FreedomCoder-utility_belt-1.1.1 spec/convertable_to_file_spec.rb
akitaonrails-utility_belt-1.0.10 spec/convertable_to_file_spec.rb
akitaonrails-utility_belt-1.0.11 spec/convertable_to_file_spec.rb
akitaonrails-utility_belt-1.0.12 spec/convertable_to_file_spec.rb
mguterl-utility_belt-1.0.7 spec/convertable_to_file_spec.rb
rwilcox-utility_belt-1.0.7 spec/convertable_to_file_spec.rb
rwilcox-utility_belt-1.0.9 spec/convertable_to_file_spec.rb
timocratic-utility_belt-1.0.7.1 spec/convertable_to_file_spec.rb
timocratic-utility_belt-1.0.7.2 spec/convertable_to_file_spec.rb
timocratic-utility_belt-1.0.7.3 spec/convertable_to_file_spec.rb
akitaonrails-utility_belt-1.0.13 spec/convertable_to_file_spec.rb
utility_belt-1.1.0 spec/convertable_to_file_spec.rb