Sha256: a539ca02e5f8cd9bd36ade96c2d6bdf7f4f54d57a8107e6ac9273a2b3c8fcf2a

Contents?: true

Size: 978 Bytes

Versions: 6

Compression:

Stored size: 978 Bytes

Contents

require 'test_helper'
require 'mocha/test_unit'

include RbVmomi
include Vmesh

class VSphereTest < Test::Unit::TestCase

  def setup
    @mock_vim = Object.new
    #@mock_vim = mock RbVmomi::VIM
    VIM.stubs(:connect).returns(@mock_vim)
    @mock_connection_options = Hash.new
    Vmesh::logger = Logger.new(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 7)
  end

  def teardown
  end

  def test_root_folder_gets_from_vim
    vsphere_vm_manager = VSphere.new(@mock_connection_options)
    mock_root_folder = Object.new
    mock_content = Object.new
    mock_content.expects(:rootFolder).returns(mock_root_folder)
    mock_service_instance = Object.new
    mock_service_instance.expects(:content).returns(mock_content)
    @mock_vim.expects(:serviceInstance).returns(mock_service_instance) #Object.new.expects(:content).expects(:rootFolder).returns('a folder'))

    root_folder = vsphere_vm_manager.root_folder 

    assert root_folder == mock_root_folder
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vmesh-0.1.11 test/power_test.rb
vmesh-0.1.7 test/power_test.rb
vmesh-0.1.6 test/power_test.rb
vmesh-0.1.5 test/power_test.rb
vmesh-0.1.4 test/power_test.rb
vmesh-0.1.3 test/power_test.rb