spec/resource_spec.rb in rlivsey-voorhees-0.1.3 vs spec/resource_spec.rb in rlivsey-voorhees-0.1.4

- old
+ new

@@ -151,12 +151,12 @@ user_from_json.raw_json.should == @json end end describe "#json_attributes" do - it "should contain symbols of the keys of the attributes available" do - user_from_json.json_attributes.sort.should == [:address, :email, :id, :messages, :name, :pet, :username] + it "should contain symbols of the keys of the attributes available as underscored" do + user_from_json.json_attributes.sort.should == [:address, :camel_case, :email, :id, :messages, :name, :pet, :username] end end describe "#json_request" do @@ -214,10 +214,15 @@ end describe "calling method with the name of a json attribute" do + it "should return the correct data from #id" do + user = user_from_json + user.id.should == @json["id"] + end + it "should define a method of the same name" do user = user_from_json user.should_not respond_to(:email) user.email @@ -232,9 +237,15 @@ end describe "which is a simple value" do it "should return the value of the attribute" do user_from_json.email.should == @json["email"] + end + end + + describe "which is camelCase in the JSON" do + it "should return the value of the attribute" do + user_from_json.camel_case.should == @json["camelCase"] end end describe "which is a collection" do it "should return an array" do