Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

… strings (bug in 1.9)
  • Loading branch information...
commit 52d9f379b9100192b3244c473403f8abcca73e48 1 parent dbd572d
@mattetti authored
Showing with 13 additions and 1 deletion.
  1. +7 −0 lib/response.rb
  2. +6 −1 spec/wd_documentation_spec.rb
View
7 lib/response.rb
@@ -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
View
7 spec/wd_documentation_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.