1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
4 #This is really a duplicate of 8302
6 describe "Stubs should correctly restore module methods" do
7 it "1 - stub the open method" do
8 File.stub!(:open).and_return("something")
9 File.open.should == "something"
11 it "2 - use File.open to create example.txt" do
12 filename = "#{File.dirname(__FILE__)}/example-#{Time.new.to_i}.txt"
13 File.exist?(filename).should be_false
14 file = File.open(filename,'w')
16 File.exist?(filename).should be_true
18 File.exist?(filename).should be_false