Sha256: 86c7681087b27a2f064777c7e68ad997ceda8bc1a9cf3232bcafd7f4806ebe23

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'test/test_helper'

describe "Loader" do
  describe "load" do
    before { reset }

    describe "module library" do
      def mock_library(*args); end

      it "loads a module library and all its class methods by default" do
        eval %[module ::Harvey; def self.bird; end; def self.eagle; end; end]
        load ::Harvey, :no_mock=>true
        library_has_command('harvey', 'bird')
        library_has_command('harvey', 'eagle')
      end

      it "loads a module library with specified commands" do
        eval %[module ::Peanut; def self.bird; end; def self.eagle; end; end]
        load ::Peanut, :no_mock=>true, :commands=>%w{bird}
        library('peanut').commands.size.should == 1
        library_has_command('peanut', 'bird')
      end

      it "loads a module library as a class" do
        eval %[class ::Mentok; def self.bird; end; def self.eagle; end; end]
        load ::Mentok, :no_mock=>true, :commands=>%w{bird}
        library('mentok').commands.size.should == 1
        library_has_command('mentok', 'bird')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
boson-more-0.3.1 test/todo/module_library_test.rb
boson-more-0.3.0 test/todo/module_library_test.rb
boson-more-0.2.2 test/todo/module_library_test.rb