Sha256: ba273124ac704c8f724549098bda98bad499ef3d73f333b5b5f01d915bdd9f80

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
require 'ronin/engine/buildable'
require 'engine/classes/buildable_class'

describe Engine::Buildable do
  subject do
    obj = BuildableClass.new
    obj.instance_eval do
      build { @output = "hello #{@var}" }
    end

    obj
  end

  it "should not be built by default" do
    subject.should_not be_built
  end

  it "should include Verifiable" do
    subject.class.included_modules.should include(Engine::Verifiable)
  end

  describe "build!" do
    it "should call the build block" do
      subject.build!

      subject.output.should == "hello world"
    end

    it "should mark the engine as built" do
      subject.build!

      subject.should be_built
    end

    it "should accept parameters as options" do
      subject.build!(:var => 'dave')

      subject.output.should == "hello dave"
      subject.var.should == 'dave'
    end
  end

  describe "verify!" do
    it "should raise a NotBuilt exception when verifying unbuilt engines" do
      lambda {
        subject.verify!
      }.should raise_error(Engine::NotBuilt)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-1.0.0.pre3 spec/engine/buildable_spec.rb
ronin-1.0.0.pre2 spec/engine/buildable_spec.rb
ronin-1.0.0.pre1 spec/engine/buildable_spec.rb