@@ -4,7 +4,8 @@ class SerializerTest < Test::Unit::TestCase
4
4
context "Rubyprot serializer" do
5
5
setup do
6
6
@test_file_path = "test/test_files/dump"
7
- @object_name = "TestClass"
7
+ @object_name = "Person"
8
+ @object_name_ends_in_s = "TestClass"
8
9
end
9
10
10
11
teardown do
@@ -16,7 +17,7 @@ class SerializerTest < Test::Unit::TestCase
16
17
17
18
should "raise error if dump path not set" do
18
19
assert_raise RuntimeError do
19
- object = TestClass . new
20
+ object = Person . new
20
21
Rubyprot . serialize ( object )
21
22
end
22
23
end
@@ -26,7 +27,7 @@ class SerializerTest < Test::Unit::TestCase
26
27
Rubyprot . dump_path = @test_file_path
27
28
end
28
29
29
- object = TestClass . new
30
+ object = Person . new
30
31
Rubyprot . serialize ( object )
31
32
32
33
assert_nothing_raised do
@@ -41,7 +42,7 @@ class SerializerTest < Test::Unit::TestCase
41
42
Rubyprot . dump_path = @test_file_path
42
43
end
43
44
44
- object = TestClass . new
45
+ object = Person . new
45
46
Rubyprot . serialize ( object )
46
47
47
48
assert_nothing_raised do
@@ -62,26 +63,43 @@ class SerializerTest < Test::Unit::TestCase
62
63
Rubyprot . dump_path = @test_file_path
63
64
end
64
65
65
- object = TestClass . new
66
+ object = Person . new
66
67
name = Rubyprot . serialize ( object )
67
68
68
69
assert_kind_of String , name
69
70
end
70
71
71
- should "return array string name for array" do
72
+ should "return string plural name for array" do
72
73
Rubyprot . configure do |config |
73
74
Rubyprot . dump_path = @test_file_path
74
75
end
75
76
76
77
array = Array . new
77
- object = TestClass . new
78
+ object = Person . new
78
79
array [ 0 ] = object
79
80
array [ 1 ] = object
80
81
81
82
name = Rubyprot . serialize ( array )
82
83
83
84
assert_kind_of String , name
85
+ assert name == "Persons"
84
86
end
87
+
88
+ should "return string plural name for array from object ending in s" do
89
+ Rubyprot . configure do |config |
90
+ Rubyprot . dump_path = @test_file_path
91
+ end
92
+
93
+ array = Array . new
94
+ object = TestClass . new
95
+ array [ 0 ] = object
96
+ array [ 1 ] = object
97
+
98
+ name = Rubyprot . serialize ( array )
99
+
100
+ assert_kind_of String , name
101
+ assert name == "TestClasses"
102
+ end
85
103
end
86
104
87
105
0 commit comments