Sha256: ee0833aeede8079295165e2f4aff01967ee392657a3c6395e5a43856a74c147f
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
#!/usr/bin/env rspec -cfd require_relative '../../spec_helper' require 'arborist/event/node_delta' describe Arborist::Event::NodeDelta do class TestNode < Arborist::Node; end let( :node ) do TestNode.new( 'foo' ) do parent 'bar' description "A testing node" tags :tree, :try, :triage, :trip update( "tcp_socket_connect" => { "time" => "2016-02-25 16:04:35 -0800", "duration" => 0.020619 } ) end end describe "subscription support" do it "matches a subscription with only an event type if the type is the same" do sub = Arborist::Subscription.new( 'node.delta' ) {} event = described_class.new( node, status: ['up', 'down'] ) expect( event ).to match( sub ) end it "matches a subscription with a matching event type and matching criteria" do sub = Arborist::Subscription.new( 'node.delta', 'tag' => 'triage' ) {} event = described_class.new( node, status: ['up', 'down'] ) expect( event ).to match( sub ) end it "matches a subscription with matching event type, node criteria, and delta criteria" do criteria = { 'tag' => 'tree', 'delta' => { 'status' => [ 'up', 'down' ] } } sub = Arborist::Subscription.new( 'node.delta', criteria ) {} event = described_class.new( node, 'status' => ['up', 'down'] ) expect( event ).to match( sub ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arborist-0.0.1.pre20160829140603 | spec/arborist/event/node_delta_spec.rb |
arborist-0.0.1.pre20160606141735 | spec/arborist/event/node_delta_spec.rb |