zilkey-active_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -1
- data/VERSION +1 -1
- data/active_api.gemspec +1 -1
- data/lib/active_api/simple_type.rb +1 -0
- data/spec/api_spec.rb +25 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -80,7 +80,7 @@ ActiveApi is highly extensible. The general pattern used to extend ActiveApi is
|
|
80
80
|
|
81
81
|
For example, if you are working with a database that has audit columns such as timestamps, you might want to do this:
|
82
82
|
|
83
|
-
class MyDefinitionClass < Definition
|
83
|
+
class MyDefinitionClass < ActiveApi::Definition
|
84
84
|
def timestamps
|
85
85
|
date_time :created_at
|
86
86
|
date_time :updated_at
|
@@ -158,6 +158,7 @@ While I (Jeff Dean) wrote all of the code in this repo, the code was inspired by
|
|
158
158
|
|
159
159
|
* Mike Dalessio
|
160
160
|
* Peter Jaros
|
161
|
+
* Ben Woosely
|
161
162
|
|
162
163
|
== Development
|
163
164
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/active_api.gemspec
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -87,7 +87,19 @@ module ActiveApi
|
|
87
87
|
doc.xpath("/articles/article/published_on").first.inner_text.should == "1956-03-05"
|
88
88
|
end
|
89
89
|
|
90
|
-
it "emits the
|
90
|
+
it "emits nil when the value is nil" do
|
91
|
+
@schema = Schema.version(:v1) do |xsl|
|
92
|
+
xsl.define :article do |t|
|
93
|
+
t.date :published_on
|
94
|
+
end
|
95
|
+
end
|
96
|
+
@article.published_on = nil
|
97
|
+
element = Collection.new [@article], :node => :article, :schema => @schema
|
98
|
+
doc = element.build_xml.doc
|
99
|
+
doc.xpath("/articles/article/published_on").first.inner_text.should == ""
|
100
|
+
end
|
101
|
+
|
102
|
+
it "emits the correctly formatted attribute" do
|
91
103
|
@schema = Schema.version(:v1) do |xsl|
|
92
104
|
xsl.define :article do |t|
|
93
105
|
t.attribute :published_on, :type => :date
|
@@ -97,6 +109,18 @@ module ActiveApi
|
|
97
109
|
doc = element.build_xml.doc
|
98
110
|
doc.xpath("/articles/article[@published_on=1956-03-05]").should be
|
99
111
|
end
|
112
|
+
|
113
|
+
it "emits nil when the attribute value is nil" do
|
114
|
+
@schema = Schema.version(:v1) do |xsl|
|
115
|
+
xsl.define :article do |t|
|
116
|
+
t.attribute :published_on, :type => :date
|
117
|
+
end
|
118
|
+
end
|
119
|
+
@article.published_on = nil
|
120
|
+
element = Collection.new [@article], :node => :article, :schema => @schema
|
121
|
+
doc = element.build_xml.doc
|
122
|
+
doc.xpath("/articles/article[@published_on='']").should be
|
123
|
+
end
|
100
124
|
end
|
101
125
|
|
102
126
|
describe "with a has_many element" do
|