model_xml 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,6 +81,7 @@ module ModelXML
81
81
  end
82
82
 
83
83
  root_node = object.class.to_s
84
+ root_node = root_node.demodulize if root_node.respond_to?(:demodulize) # Rails only
84
85
  root_node = root_node.underscore if root_node.respond_to?(:underscore) # Rails only
85
86
 
86
87
  xml.tag! root_node do
data/model_xml.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "model_xml"
3
- s.version = '1.0.11'
3
+ s.version = '1.0.12'
4
4
  s.authors = "Rob Anderson"
5
5
  s.email = "rob.anderson@paymentcardsolutions.co.uk"
6
6
  s.summary = "Ruby object to xml converter"
@@ -16,7 +16,7 @@ class BlockParserTest < Test::Unit::TestCase
16
16
  block = Proc.new do
17
17
  field :id, 2
18
18
  end
19
- assert_equal [[:id, 2]], ModelXML::BlockParser.parse(&block).inspect
19
+ assert_equal [[:id, 2]], ModelXML::BlockParser.parse(&block)
20
20
  end
21
21
 
22
22
  end
@@ -32,9 +32,9 @@ class ModelXMLTest < Test::Unit::TestCase
32
32
  assert_equal [[:foo]], TestStruct.model_xml_generator.field_sets
33
33
 
34
34
  res = '<?xml version="1.0" encoding="UTF-8"?>
35
- <test_struct>
35
+ <TestStruct>
36
36
  <foo>1</foo>
37
- </test_struct>
37
+ </TestStruct>
38
38
  '
39
39
  assert_equal res, @t.to_xml
40
40
  end
@@ -51,10 +51,10 @@ class ModelXMLTest < Test::Unit::TestCase
51
51
  assert_equal [[:foo, :bar]], TestStruct.model_xml_generator.field_sets
52
52
 
53
53
  res = '<?xml version="1.0" encoding="UTF-8"?>
54
- <test_struct>
54
+ <TestStruct>
55
55
  <foo>1</foo>
56
56
  <bar>2</bar>
57
- </test_struct>
57
+ </TestStruct>
58
58
  '
59
59
  assert_equal res, @t.to_xml
60
60
  end
@@ -70,11 +70,11 @@ class ModelXMLTest < Test::Unit::TestCase
70
70
  end
71
71
 
72
72
  res = '<?xml version="1.0" encoding="UTF-8"?>
73
- <test_struct>
73
+ <TestStruct>
74
74
  <foo>1</foo>
75
75
  <bar>2</bar>
76
76
  <foobar>3</foobar>
77
- </test_struct>
77
+ </TestStruct>
78
78
  '
79
79
  assert_equal res, @t.to_xml
80
80
  end
@@ -85,10 +85,10 @@ class ModelXMLTest < Test::Unit::TestCase
85
85
  model_xml :foo, :bar
86
86
  end
87
87
 
88
- res = '<test_struct>
88
+ res = '<TestStruct>
89
89
  <foo>1</foo>
90
90
  <bar>2</bar>
91
- </test_struct>
91
+ </TestStruct>
92
92
  '
93
93
  assert_equal res, @t.to_xml(:skip_instruct => true)
94
94
 
@@ -98,12 +98,12 @@ class ModelXMLTest < Test::Unit::TestCase
98
98
  p = Parent.new(:foo => 1, :child => Child.new(:bar => 2))
99
99
 
100
100
  res = '<?xml version="1.0" encoding="UTF-8"?>
101
- <parent>
101
+ <Parent>
102
102
  <foo>1</foo>
103
- <child>
103
+ <Child>
104
104
  <bar>2</bar>
105
- </child>
106
- </parent>
105
+ </Child>
106
+ </Parent>
107
107
  '
108
108
  assert_equal res, p.to_xml
109
109
  end
@@ -117,9 +117,9 @@ class ModelXMLTest < Test::Unit::TestCase
117
117
  end
118
118
 
119
119
  res = '<?xml version="1.0" encoding="UTF-8"?>
120
- <test_struct>
120
+ <TestStruct>
121
121
  <id>foo</id>
122
- </test_struct>
122
+ </TestStruct>
123
123
  '
124
124
  assert_equal res, @t.to_xml
125
125
  end
@@ -131,9 +131,9 @@ class ModelXMLTest < Test::Unit::TestCase
131
131
  end
132
132
 
133
133
  res = '<?xml version="1.0" encoding="UTF-8"?>
134
- <test_struct>
134
+ <TestStruct>
135
135
  <foo>1</foo>
136
- </test_struct>
136
+ </TestStruct>
137
137
  '
138
138
  assert_equal res, @t.to_xml(:except => [:bar])
139
139
  assert_equal res, @t.to_xml(:only => [:foo])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_xml
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 11
10
- version: 1.0.11
9
+ - 12
10
+ version: 1.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rob Anderson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-25 00:00:00 Z
18
+ date: 2012-06-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder