Sha256: 88f698cf3c45db118480e65120350c055bd1c2c807ba5d29e84479acabfd879c
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' require 'getoptions' describe Igp::Base::Format do describe '#duration' do it "should return nil for nil duration" do subject.duration(nil).should be_nil end it "should return string to 6 decimal places for non-nil duration" do result = subject.duration(1.0) result.should match(/^\d+\.\d{6}$/) result.to_f.should eql(1.0) end it "should handle integer parameter" do result = subject.duration(1) result.should match(/^\d+\.\d{6}$/) result.to_f.should eql(1.0) end end describe '#header' do it "should output a blank line for nil parameters" do result = capture(:stderr){ subject.header(nil) } result.should eql("\n") end it "should convert an arbitrary array of strings and numbers to a space-delimited output to stderr" do result = capture(:stderr){ subject.header("string",1.0,"another string",2.0) } result.should eql("string 1.0 another string 2.0\n") end end describe '#log' do it "should output time only for nil parameters" do result = capture(:stdout){ subject.log(nil) } result.should match(/^.+Z,$/) end it "should log successful message (boolean,float,nil) to stdout" do result = capture(:stdout){ subject.log(true,1.0,nil) } result.should match(/^.+Z,true,1.0,$/) end it "should log unsuccessful message (boolean,nil,string) to stdout" do result = capture(:stdout){ subject.log(false,nil,"message") } result.should match(/^.+Z,false,,message$/) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
igp-0.0.3 | spec/format_spec.rb |
igp-0.0.2 | spec/format_spec.rb |