graft 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -0
- data/lib/graft/core_ext/hash.rb +9 -0
- data/lib/graft/json.rb +14 -0
- data/lib/graft/json/attribute.rb +18 -0
- data/lib/graft/json/model.rb +28 -0
- data/lib/graft/model.rb +13 -44
- data/lib/graft/version.rb +2 -2
- data/lib/graft/xml.rb +19 -0
- data/lib/graft/xml/attribute.rb +52 -0
- data/lib/graft/xml/model.rb +49 -0
- data/lib/graft/xml/type.rb +91 -0
- data/test/test_helper.rb +4 -3
- data/test/unit/core_ext/hash_test.rb +29 -0
- data/test/unit/json/attribute_test.rb +51 -0
- data/test/unit/json/model_test.rb +86 -0
- data/test/unit/xml/attribute_test.rb +161 -0
- data/test/unit/{model_test.rb → xml/model_test.rb} +65 -47
- data/test/unit/xml/type_test.rb +65 -0
- metadata +26 -9
- data/lib/graft.rb +0 -13
- data/lib/graft/attribute.rb +0 -50
- data/lib/graft/type.rb +0 -89
- data/test/unit/attribute_test.rb +0 -159
- data/test/unit/source_test.rb +0 -16
- data/test/unit/type_test.rb +0 -63
data/test/unit/type_test.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
-
|
3
|
-
module Graft
|
4
|
-
|
5
|
-
class StringTest < Test::Unit::TestCase
|
6
|
-
context "An instance of the Graft::Type::String class" do
|
7
|
-
|
8
|
-
should_convert 'a string', :to => 'a string'
|
9
|
-
should_convert '', :to => nil
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class BooleanTest < Test::Unit::TestCase
|
15
|
-
context "An instance of the Graft::Type::Boolean class" do
|
16
|
-
|
17
|
-
should_convert 'true', :to => true
|
18
|
-
should_convert 'false', :to => false
|
19
|
-
should_convert '0', :to => false
|
20
|
-
should_convert '1', :to => true
|
21
|
-
should_convert '', :to => nil
|
22
|
-
|
23
|
-
should_fail_when_converting 'foo'
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class IntegerTest < Test::Unit::TestCase
|
29
|
-
context "An instance of the Graft::Type::Integer class" do
|
30
|
-
|
31
|
-
should_convert '1', :to => 1
|
32
|
-
should_convert '', :to => nil
|
33
|
-
|
34
|
-
should_fail_when_converting 'foo'
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class DateTest < Test::Unit::TestCase
|
40
|
-
|
41
|
-
context "An instance of the Graft::Type::Date class" do
|
42
|
-
|
43
|
-
should_convert '2008-08-01', :to => Date.parse('2008-08-01')
|
44
|
-
should_convert '', :to => nil
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
class TimeTest < Test::Unit::TestCase
|
51
|
-
|
52
|
-
context "An instance of the Graft::Type::Time class" do
|
53
|
-
|
54
|
-
should_convert '2008-07-28T16:57:10Z', :to => Time.parse('2008-07-28T16:57:10Z')
|
55
|
-
should_convert '2008-12-25 18:26:55', :to => Time.parse('2008-12-25 18:26:55')
|
56
|
-
should_convert '1230274722', :to => Time.at(1230274722)
|
57
|
-
should_convert '', :to => nil
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|