Sha256: 770aa9700eb8dc1c1d1cf35246710df93c0ca19c3bf3ef0c37e531acda735099

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ronin-exploits-0.3.1 spec/controls/behaviors_examples.rb
ronin-exploits-0.3.0 spec/controls/behaviors_examples.rb