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 CHANGED
@@ -1 +1 @@
1
- 0.3.1
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(opts.merge(:name => name, :type => :string))
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wsdsl}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Matt Aimonetti}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wsdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: