Sha256: 91114616ff76f26f53e80ad5b22271378399c9fc928739cb6d6634717de1e1eb

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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.2.1 test/module_library_test.rb
boson-more-0.2.0 test/module_library_test.rb
boson-more-0.1.0 test/module_library_test.rb