Sha256: 45ea9e428276e29620ab4f7848ae884ed75e57c63c4c2b983bb1b6c4016b1031
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'test_helper' # Cannot use require since file name has no extension. load File.join(File.dirname(__FILE__), '../bin/viewobs') class ViewobsTest < Test::Unit::TestCase context "Viewobs#view_line" do setup do @vo = Viewobs.new @vo.options = {} @line = File.readlines(fixture_file("double-obs.log")).first @attributes = LogParser.parse_line(@line) @observation = Observation.new(@attributes) end should "raise NoMethodError if there are two observations in one log line" do assert_raises(NoMethodError) { @vo.view_line(@attributes, @observation) } end end context "Viewobs when encountering a line with two observations" do setup do @argv = ARGV.dup ARGV.replace [fixture_file("double-obs.log")] @vo = Viewobs.new @vo.options = {}; @buffer = "" @stderr, $stderr = $stderr, StringIO.new(@buffer) end teardown do ARGV.replace @argv $stderr = @stderr if @stderr end should "not crash" do assert_nothing_raised { @vo.view_until_end } end should "report on stderr" do assert @buffer.empty? @vo.view_until_end assert ! @buffer.empty? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logbox-0.2.10 | test/bin_viewobs_test.rb |