Permalink
Browse files

add code coverage to test suite

  • Loading branch information...
1 parent dc57cb1 commit ad700b6c672a7e97cef8dee439b221c43bb9f85f @rlane rlane committed Nov 6, 2011
View
@@ -6,3 +6,4 @@ vmodl
doc
.yardoc
*.rbc
+coverage
@@ -1,17 +1,9 @@
-begin
- require 'cover_me'
-rescue LoadError
- puts "Install the cover_me gem for code coverage"
-end
-
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class DeserializationTest < Test::Unit::TestCase
def setup
@soap = VIM.new(:ns => 'urn:vim25', :rev => '4.0')
- @deserializer = RbVmomi::OldDeserializer.new @soap
+ @deserializer = RbVmomi::Deserializer.new @soap
end
def check str, expected, type
@@ -1,6 +1,4 @@
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class EmitRequestTest < Test::Unit::TestCase
MO = VIM::VirtualMachine(nil, "foo")
@@ -1,6 +1,4 @@
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class ExceptionTest < Test::Unit::TestCase
def test_fault
View
@@ -0,0 +1,14 @@
+coverage_tool = :simplecov if ENV['RBVMOMI_COVERAGE']
+
+case coverage_tool
+when :simplecov
+ require 'simplecov'
+ SimpleCov.start
+when :cover_me
+ require 'cover_me'
+end
+
+require 'rbvmomi'
+VIM = RbVmomi::VIM
+
+require 'test/unit'
View
@@ -1,6 +1,4 @@
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class MiscTest < Test::Unit::TestCase
def test_overridden_const
@@ -1,6 +1,4 @@
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class ParseResponseTest < Test::Unit::TestCase
def check desc, str, expected
@@ -1,6 +1,4 @@
-require 'test/unit'
-require 'rbvmomi'
-VIM = RbVmomi::VIM unless Object.const_defined? :VIM
+require 'test_helper'
class SerializationTest < Test::Unit::TestCase
def check str, obj, type, array=false

0 comments on commit ad700b6

Please sign in to comment.