wsdsl 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/response.rb +1 -1
- data/spec/json_response_description_spec.rb +13 -1
- data/wsdsl.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/response.rb
CHANGED
@@ -266,7 +266,7 @@ class WSDSL
|
|
266
266
|
# @param [Symbol, String] name the name of the attribute.
|
267
267
|
# @param [Hash] opts the attribute options.
|
268
268
|
def string(name=nil, opts={})
|
269
|
-
attribute(
|
269
|
+
attribute({name => :string}.merge(opts))
|
270
270
|
end
|
271
271
|
|
272
272
|
# Shortcut to create a string attribute
|
@@ -27,15 +27,17 @@ describe "WSDSL JSON response description" do
|
|
27
27
|
=end
|
28
28
|
|
29
29
|
before :all do
|
30
|
+
@timestamp = Time.now.to_i
|
30
31
|
@service = describe_service "json_list" do |service|
|
31
32
|
service.formats :json
|
32
33
|
service.response do |response|
|
33
34
|
response.array :vouchers do |node|
|
34
35
|
node.key :id
|
35
36
|
node.type :Voucher
|
37
|
+
node.string :name, :mock => "test"
|
36
38
|
node.integer :id, :doc => "Identifier"
|
37
39
|
node.boolean :redeemed
|
38
|
-
node.datetime :created_at
|
40
|
+
node.datetime :created_at, :mock => @timestamp
|
39
41
|
node.object :option do |option|
|
40
42
|
option.integer :id
|
41
43
|
option.integer :deal_id, :mock => 1
|
@@ -90,5 +92,15 @@ describe "WSDSL JSON response description" do
|
|
90
92
|
@root_node.key.should == :id
|
91
93
|
@root_node.type.should == :Voucher
|
92
94
|
end
|
95
|
+
|
96
|
+
it "should handle mocked values properly" do
|
97
|
+
created_at = @root_node.properties.find{|prop| prop.name == :created_at}
|
98
|
+
created_at.opts[:mock].should == @timestamp
|
99
|
+
option = @root_node.objects.find{|prop| prop.name == :option}
|
100
|
+
deal_id = option.properties.find{|prop| prop.name == :deal_id}
|
101
|
+
deal_id.opts[:mock].should == 1
|
102
|
+
name = @root_node.properties.find{|prop| prop.name == :name}
|
103
|
+
name.opts[:mock].should == "test"
|
104
|
+
end
|
93
105
|
|
94
106
|
end
|
data/wsdsl.gemspec
CHANGED