Class: Mu::Xtractr::Stream::Test

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/mu/xtractr/test/tc_stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



23
24
25
# File 'lib/mu/xtractr/test/tc_stream.rb', line 23

def stream
  @stream
end

#xtractrObject (readonly)

Returns the value of attribute xtractr.



22
23
24
# File 'lib/mu/xtractr/test/tc_stream.rb', line 22

def xtractr
  @xtractr
end

Instance Method Details

#setupObject



25
26
27
28
# File 'lib/mu/xtractr/test/tc_stream.rb', line 25

def setup
    @xtractr = Xtractr.new
    @stream = xtractr.flows('flow.service:HTTP').first.stream
end

#test_eachObject



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mu/xtractr/test/tc_stream.rb', line 38

def test_each
    assert_equal(stream.method(:each), stream.method(:each_message))
    assert_equal(2, stream.messages.size)
    stream.each_with_index do |m, i|
        assert_kind_of(Stream::Message, m)
        assert_equal(i, m.index)
        assert_equal(stream.__id__, m.stream.__id__)
        assert_equal(true, m.dir == 0 || m.dir == 1)
        assert_nothing_raised { m.inspect }
    end
end

#test_flowObject



34
35
36
# File 'lib/mu/xtractr/test/tc_stream.rb', line 34

def test_flow
    assert_kind_of(Flow, stream.flow)
end

#test_inspectObject



50
51
52
# File 'lib/mu/xtractr/test/tc_stream.rb', line 50

def test_inspect
    assert_nothing_raised { stream.inspect }
end

#test_StreamObject



30
31
32
# File 'lib/mu/xtractr/test/tc_stream.rb', line 30

def test_Stream
    assert(Stream.ancestors.include?(Enumerable), "Stream doesn't mixin Enumerable")
end