schematic 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -71,7 +71,7 @@ module Schematic
71
71
  def generate_additional_methods(builder, additional_methods)
72
72
  additional_methods.each do |method_name, values|
73
73
  method_xsd_name = method_name.to_s.dasherize
74
- if values.present?
74
+ if values.is_a?(Array) || values.is_a?(Hash)
75
75
  builder.xs :element, "name" => method_xsd_name, "minOccurs" => "0", "maxOccurs" => "1" do |element|
76
76
  element.xs :complexType do |complex_type|
77
77
  if values.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module Schematic
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -19,21 +19,25 @@ describe Schematic::Serializers::Xsd do
19
19
  with_model :some_model do
20
20
  table do |t|
21
21
  t.string "some_string"
22
+ t.text "some_text"
22
23
  t.float "some_float"
23
24
  t.integer "some_integer"
24
25
  t.datetime "some_datetime"
25
26
  t.date "some_date"
26
27
  t.boolean "some_boolean"
28
+ t.text "method_is_also_columns"
29
+ t.text "method_is_also_an_empty_column"
27
30
  end
28
31
 
29
32
  model do
30
33
  validates :some_string, :presence => true, :length => { :maximum => 100 }
34
+ validates :some_text, :presence => true
31
35
  validates :some_date, :presence => true, :allow_blank => true
32
36
  validates :some_datetime, :presence => true, :allow_blank => false
33
37
 
34
38
  class << self
35
39
  def xsd_methods
36
- {:foo => { :bar => { :baz => nil }, :quz => [:qaz] } }
40
+ {:foo => { :bar => { :baz => nil }, :quz => [:qaz] }, :method_is_also_columns => [:method_is_also_column], :method_is_also_an_empty_column =>[ ] }
37
41
  end
38
42
  end
39
43
  end
@@ -47,11 +51,15 @@ describe Schematic::Serializers::Xsd do
47
51
  it "should validate against it's own XSD" do
48
52
  instance = SomeModel.new(:some_string => "ExampleString",
49
53
  :some_date => Date.today,
54
+ :some_text => "here is some text",
50
55
  :some_datetime => DateTime.new,
51
56
  :some_boolean => true,
52
57
  :some_float => 1.5,
58
+ :method_is_also_columns => [{:some => "somevalues"}],
59
+ :method_is_also_an_empty_column => [],
53
60
  :some_integer => 2)
54
61
  xml = [instance].to_xml
62
+
55
63
  validate_xml_against_xsd(xml, subject)
56
64
  end
57
65
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: schematic
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.7
5
+ version: 0.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Case Commons, LLC