Class: Mu::Xtractr::Term::Test
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Mu::Xtractr::Term::Test
- Defined in:
- lib/mu/xtractr/test/tc_term.rb
Instance Attribute Summary collapse
-
#term ⇒ Object
readonly
Returns the value of attribute term.
-
#xtractr ⇒ Object
readonly
Returns the value of attribute xtractr.
Instance Method Summary collapse
- #setup ⇒ Object
- #test_attributes ⇒ Object
- #test_each ⇒ Object
- #test_inspect ⇒ Object
- #test_packets ⇒ Object
- #test_Term ⇒ Object
Instance Attribute Details
#term ⇒ Object (readonly)
Returns the value of attribute term.
23 24 25 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 23 def term @term end |
#xtractr ⇒ Object (readonly)
Returns the value of attribute xtractr.
22 23 24 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 22 def xtractr @xtractr end |
Instance Method Details
#setup ⇒ Object
25 26 27 28 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 25 def setup @xtractr = Xtractr.new @term = xtractr.field('http.request.method').terms.first end |
#test_attributes ⇒ Object
34 35 36 37 38 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 34 def test_attributes assert_kind_of(Field, term.field) assert_equal('get', term.value) assert_equal(116, term.frequency) end |
#test_each ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 40 def test_each assert_equal(term.method(:each), term.method(:each_packet)) term.each_with_index do |pkt, i| assert_kind_of(Packet, pkt) break if i < 16 end end |
#test_inspect ⇒ Object
53 54 55 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 53 def test_inspect assert_nothing_raised { term.inspect } end |
#test_packets ⇒ Object
48 49 50 51 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 48 def test_packets packets = term.packets assert_equal("http.request.method:get", packets.q) end |
#test_Term ⇒ Object
30 31 32 |
# File 'lib/mu/xtractr/test/tc_term.rb', line 30 def test_Term assert(Term.ancestors.include?(Enumerable), "Term doesn't mixin Enumerable") end |