Permalink
Browse files

added specs showing that top level array responses aren't currently s…

…upported (test suite will break)
  • Loading branch information...
1 parent 3efcd30 commit 3ac386202ebc29cf703ddb0d35f2a68c28cf27f7 @mattetti committed Apr 27, 2013
Showing with 29 additions and 0 deletions.
  1. +29 −0 spec/json_response_verification_spec.rb
@@ -73,6 +73,18 @@
end
end
+ @top_level_array_service = describe_service "tl_array#{__LINE__}" do |service|
+ service.formats :json
+ service.response do |response|
+ # anonymous array response
+ response.array do |arr|
+ arr.object do |node|
+ node.string :name
+ end
+ end
+ end
+ end
+
end
@@ -120,6 +132,10 @@ def valid_nested_array_response
}
end
+ def valid_top_level_array_response
+ [ { :name => "Bob" }, { :name => "Judy" } ]
+ end
+
it "should validate the response" do
valid, errors = @service.validate_hash_response(valid_response)
@@ -221,5 +237,18 @@ def valid_nested_array_response
valid.should be_true
end
+ it "should validate the response" do
+ valid, errors = @service.validate_hash_response(valid_response)
+ errors.should == []
+ valid.should be_true
+ errors.should be_empty
+ end
+
+ it "should validated a top level array" do
+ valid, errors = @top_level_array_service.validate_hash_response(valid_top_level_array_response)
+ errors.should == []
+ valid.should be_true
+ errors.should be_empty
+ end
end

0 comments on commit 3ac3862

Please sign in to comment.