spec/arborist/node/resource_spec.rb in arborist-0.0.1.pre20160606141735 vs spec/arborist/node/resource_spec.rb in arborist-0.0.1.pre20160829140603

- old
+ new

@@ -17,10 +17,14 @@ it "can be created without reasonable defaults based on its identifier" do result = described_class.new( 'disk', host ) expect( result.identifier ).to eq( "testhost-disk" ) end + it "defaults the category to the identifier" do + result = described_class.new( 'load', host ) + expect( result.category ).to eq( 'load' ) + end it "raises a sensible error when created without a host" do expect { described_class.new( 'load', nil ) }.to raise_error( Arborist::NodeError, /no host/i ) @@ -48,9 +52,14 @@ it "can be matched with a netblock that includes one of its host's addresses" do expect( node ).to match_criteria( address: '192.168.66.0/24' ) expect( node ).to match_criteria( address: '10.0.0.0/8' ) expect( node ).to_not match_criteria( address: '192.168.66.64/27' ) expect( node ).to_not match_criteria( address: '127.0.0.0/8' ) + end + + it "can be matched with a category" do + expect( node ).to match_criteria( category: 'disk' ) + expect( node ).to_not match_criteria( category: 'processes' ) end end end