Sha256: d00884a7f26267a375f423555c134044367ff03510af38f3ba9e82c87064dbaa

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

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

describe Script::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 Testable" do
    subject.class.included_modules.should include(Script::Testable)
  end

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

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

    it "should mark the script 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 scripts" do
      lambda {
        subject.test!
      }.should raise_error(Script::NotBuilt)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ronin-1.5.0 spec/script/buildable_spec.rb
ronin-1.5.0.rc2 spec/script/buildable_spec.rb
ronin-1.5.0.rc1 spec/script/buildable_spec.rb
ronin-1.4.1 spec/script/buildable_spec.rb
ronin-1.4.0 spec/script/buildable_spec.rb
ronin-1.4.0.rc2 spec/script/buildable_spec.rb
ronin-1.4.0.rc1 spec/script/buildable_spec.rb
ronin-1.3.0 spec/script/buildable_spec.rb
ronin-1.2.0 spec/script/buildable_spec.rb
ronin-1.1.0 spec/script/buildable_spec.rb
ronin-1.1.0.rc3 spec/script/buildable_spec.rb
ronin-1.1.0.rc2 spec/script/buildable_spec.rb
ronin-1.1.0.rc1 spec/script/buildable_spec.rb