summaryrefslogtreecommitdiffhomepage
path: root/test/util
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-23 23:52:34 +0900
committerRandy Morgan <[email protected]>2012-03-23 23:52:34 +0900
commitad7119b5927584e4fc735ce72ea69322c3e9acac (patch)
treeb9ac11d22433f133bb1644b8c26bdd4a0886c555 /test/util
parentcd6fb747bbf2915f92f1fb0169e7f54d87aa1915 (diff)
downloadcaxlsx-ad7119b5927584e4fc735ce72ea69322c3e9acac.tar.gz
caxlsx-ad7119b5927584e4fc735ce72ea69322c3e9acac.zip
move requires out of specs and into helper that prepends lib directory for requires
Diffstat (limited to 'test/util')
-rw-r--r--test/util/tc_simple_typed_list.rb17
-rw-r--r--test/util/tc_validators.rb15
2 files changed, 15 insertions, 17 deletions
diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb
index 6195153e..482ea8e3 100644
--- a/test/util/tc_simple_typed_list.rb
+++ b/test/util/tc_simple_typed_list.rb
@@ -1,11 +1,10 @@
-require 'test/unit'
-require 'axlsx.rb'
+require 'tc_helper.rb'
class TestSimpleTypedList < Test::Unit::TestCase
- def setup
+ def setup
@list = Axlsx::SimpleTypedList.new Fixnum
end
- def teardown
+ def teardown
end
def test_type_is_a_class_or_array_of_class
@@ -15,18 +14,18 @@ class TestSimpleTypedList < Test::Unit::TestCase
assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new "1" }
assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new [Integer, "Class"] }
end
-
+
def test_indexed_based_assignment
#should not allow nil assignment
assert_raise(ArgumentError) { @list[0] = nil }
assert_raise(ArgumentError) { @list[0] = "1" }
assert_nothing_raised { @list[0] = 1 }
end
-
+
def test_concat_assignment
assert_raise(ArgumentError) { @list << nil }
assert_raise(ArgumentError) { @list << "1" }
- assert_nothing_raised { @list << 1 }
+ assert_nothing_raised { @list << 1 }
end
def test_concat_should_return_index
@@ -59,8 +58,8 @@ class TestSimpleTypedList < Test::Unit::TestCase
assert_nothing_raised { @list.delete_at 3 }
@list.unlock
#ignore garbage
- assert_nothing_raised { @list.delete 0 }
- assert_nothing_raised { @list.delete 9 }
+ assert_nothing_raised { @list.delete 0 }
+ assert_nothing_raised { @list.delete 9 }
end
end
diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb
index 09afcc27..d4f98d05 100644
--- a/test/util/tc_validators.rb
+++ b/test/util/tc_validators.rb
@@ -1,30 +1,29 @@
-require 'test/unit'
-require 'axlsx.rb'
+require 'tc_helper.rb'
class TestValidators < Test::Unit::TestCase
- def setup
+ def setup
end
def teardown
end
-
+
def test_validators
#unsigned_int
assert_nothing_raised { Axlsx.validate_unsigned_int 1 }
assert_nothing_raised { Axlsx.validate_unsigned_int +1 }
assert_raise(ArgumentError) { Axlsx.validate_unsigned_int -1 }
assert_raise(ArgumentError) { Axlsx.validate_unsigned_int '1' }
-
+
#int
assert_nothing_raised { Axlsx.validate_int 1 }
assert_nothing_raised { Axlsx.validate_int -1 }
assert_raise(ArgumentError) { Axlsx.validate_int 'a' }
assert_raise(ArgumentError) { Axlsx.validate_int Array }
-
+
#boolean (as 0 or 1, :true, :false, true, false, or "true," "false")
[0,1,:true, :false, true, false, "true", "false"].each do |v|
assert_nothing_raised { Axlsx.validate_boolean 0 }
end
assert_raise(ArgumentError) { Axlsx.validate_boolean 2 }
-
+
#string
assert_nothing_raised { Axlsx.validate_string "1" }
assert_raise(ArgumentError) { Axlsx.validate_string 2 }
@@ -64,7 +63,7 @@ class TestValidators < Test::Unit::TestCase
assert_raise(ArgumentError) { Axlsx.validate_content_type nil }
assert_raise(ArgumentError) { Axlsx.validate_content_type "http://some.url" }
assert_raise(ArgumentError) { Axlsx.validate_content_type false }
-
+
#relationshipType
assert_nothing_raised { Axlsx.validate_relationship_type Axlsx::WORKBOOK_R }
assert_raise(ArgumentError) { Axlsx.validate_relationship_type nil }