Sha256: 9eb08ba5b4a06b44cc0dce1ab8d16bb050d108ed08660a1a62b12f74f5c1a9dc

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require 'ronin/platform/overlay'

require 'platform/helpers/overlays'
require 'spec_helper'

describe Platform::Overlay do
  describe "initialize_metadata" do
    before(:all) do
      @overlay = Platform::Overlay.new(File.join(OVERLAY_CACHE,'hello'))
    end

    it "should load the title" do
      @overlay.title.should == 'Hello World'
    end

    it "should load the website" do
      @overlay.website.should == 'http://ronin.rubyforge.org/'
    end

    it "should load the license" do
      @overlay.license.should == 'GPL-2'
    end

    it "should load the maintainers" do
      @overlay.maintainers.find { |maintainer|
        maintainer.name == 'Postmodern' && \
          maintainer.email == 'postmodern.mod3@gmail.com'
      }.should_not be_nil
    end

    it "should load the description" do
      @overlay.description.should == %{This is a test overlay used in Ronin's specs.}
    end
  end

  describe "activate!" do
    before(:all) do
      @overlay = Platform::Overlay.new(File.join(OVERLAY_CACHE,'hello'))
      @overlay.activate!
    end

    it "should load the init.rb file if present" do
      $hello_overlay_loaded.should == true
    end

    it "should make the lib directory accessible to Kernel#require" do
      require('stuff/test').should == true
    end
  end

  describe "deactivate!" do
    before(:all) do
      @overlay = Platform::Overlay.new(File.join(OVERLAY_CACHE,'hello'))
      @overlay.deactivate!
    end

    it "should make the lib directory unaccessible to Kernel#require" do
      lambda {
        require 'stuff/another_test'
      }.should raise_error(LoadError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ronin-0.3.0 spec/platform/overlay_spec.rb
ronin-0.2.4 spec/platform/overlay_spec.rb
ronin-0.2.3 spec/platform/overlay_spec.rb