require 'spec_helper' shared_examples_for "controls behaviors" do it "should have a model to represent the controled behaviors" do @controler.control_model.include?(Ronin::Model).should == true end it "should not have any controled behaviors by default" do @controler.controls.should be_empty end it "should specify what behaviors to be controled" do @controler.control :memory_read, :memory_write @controler.behaviors.should == [:memory_read, :memory_write] end it "should extend a control module if on exists for the behavior" do @controler.control :command_exec @controler.behaviors.should == [:command_exec] @controler.kind_of?(Ronin::Controls::Helpers::CommandExec).should == true end it "should not extend a control module if none exist for the behavior" do @controler.control :exhaust_memory @controler.behaviors.should == [:exhaust_memory] end it "should load the control modules for the behaviors" do @controler.control :command_exec @controler.cache! cached = @controler.class.load_first(:name => @controler.name) cached.kind_of?(Ronin::Controls::Helpers::CommandExec).should == true end end