Sha256: 5cf97cb975036899c041d30461019f10a5d3019ceed29d9102b414fd00cec83c
Contents?: true
Size: 1.27 KB
Versions: 6
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' require 'tempfile' require 'timecop' describe EY::Serverside::Shell do it "has a timestamp before each line" do time1 = Time.local(2008, 9, 1, 12, 0, 0) time2 = Time.local(2008, 9, 1, 12, 3, 5) time3 = Time.local(2008, 9, 1, 12, 10, 25) @output = StringIO.new @shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path => Pathname.new(Dir.tmpdir).join("engineyard-serverside-#{Time.now.to_i}-${$$}.log"), :start_time => time1) Timecop.freeze(time1) do @shell.debug('test1') @shell.warning('test2') end Timecop.freeze(time2) do @shell.info('test3') @shell.debug("test11\ntest12\ntest13") @shell.warning("test21\ntest22\ntest23") end Timecop.freeze(time3) do @shell.info("test31\ntest32\ntest33") end timestamp_1 = "+ 0m 00s " timestamp_2 = "+ 3m 05s " timestamp_3 = "+10m 25s " @output.rewind @output.read.should == <<-OUTPUT #{timestamp_1}test1 #{timestamp_1}!> WARNING: test2 #{timestamp_2}test3 #{timestamp_2}test11 #{timestamp_2}test12 #{timestamp_2}test13 #{timestamp_2}!> WARNING: test21 #{timestamp_2}!> test22 #{timestamp_2}!> test23 #{timestamp_3}test31 #{timestamp_3}test32 #{timestamp_3}test33 OUTPUT end end
Version data entries
6 entries across 6 versions & 1 rubygems