Permalink
Browse files

added a spec to make sure the response elements get converted to json…

… strings (bug in 1.9)
  • Loading branch information...
1 parent dbd572d commit 52d9f379b9100192b3244c473403f8abcca73e48 @mattetti committed May 11, 2012
Showing with 13 additions and 1 deletion.
  1. +7 −0 lib/response.rb
  2. +6 −1 spec/wd_documentation_spec.rb
View
@@ -348,6 +348,13 @@ def to_hash
end
end
+ # Converts an element into a json representation
+ #
+ # @return [String] the element attributes formated in a json structure
+ def to_json
+ to_hash.to_json
+ end
+
def to_html
output = ""
if name
@@ -63,8 +63,13 @@
@service.response.elements.first.doc.name.should == "player_creation_ratings"
end
+ it "should have a json representation of an response element" do
+ json = @service.response.elements.first.to_json
+ loaded_json = JSON.load(json)
+ loaded_json[@service.response.elements.first.doc.name].should_not be_empty
+ end
+
it "should have documentation for a response element attribute" do
- p @service.response.elements.first.doc.inspect
@service.response.elements.first.doc.attributes.should_not be_empty
@service.response.elements.first.doc.attributes[:id].should == "id doc"
end

0 comments on commit 52d9f37

Please sign in to comment.