spec/rews/util_spec.rb in rews-0.5.1 vs spec/rews/util_spec.rb in rews-0.5.3

- old
+ new

@@ -14,24 +14,32 @@ describe "camelize" do it "should camelize a String" do Util.camelize("foo_bar").should == "FooBar" end + + it "should camelize a Symbol" do + Util.camelize(:foo_bar).should == :FooBar + end end describe "camel_keys" do it "should camelize the keys of a Hash" do Util.camel_keys(:foo_bar=>1, "bar_baz"=>2, "bam"=>3).should == {"FooBar"=>1, "BarBaz"=>2, "Bam"=>3} end end describe "rsxml_to_xml" do - it "should camelize tags and attribute names, and prefix tags with t:" do + it "should camelize tags and attribute names, and give un-namespaced tags 't' prefix" do Util.rsxml_to_xml([:foo]).should == "<t:Foo></t:Foo>" Util.rsxml_to_xml([:foo_foo, {:bar_bar=>"blah"}]).should == '<t:FooFoo BarBar="blah"></t:FooFoo>' Util.rsxml_to_xml([:foo_foo, {:bar_bar=>"blah"}, "foofoo", [:baz_baz, {:boo_hoo=>"10"}, "bazbaz"]]).should == '<t:FooFoo BarBar="blah">foofoo<t:BazBaz BooHoo="10">bazbaz</t:BazBaz></t:FooFoo>' + end + + it "should not prefix tags which are already namespaced" do + Util.rsxml_to_xml([[:foo, "f", "http://f.com/f"]]).should == '<f:Foo xmlns:f="http://f.com/f"></f:Foo>' end end describe "with_error_check" do it "should yield, convert the response to a hash and fetch_in the status" do