require_relative '../lib/text.rb' describe Text do it "should be able to replace text in file" do FileUtils.mkdir('tmp') if(!File.exists?('tmp')) File.open('tmp/test.txt','w'){|f| f.write("test thing") } Text.replace_in_file('tmp/test.txt','thing','string') expect(IO.read('tmp/test.txt').include?('test string')).to eq(true) end end