1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00
httparty/spec/string_spec.rb
John Nunemaker c5e229b696 Added multiple specs and fixed bug where snake_case was not defined for string.
Hash, String and HTTParty::XML all got spec additions.
2009-01-31 00:50:10 -05:00

27 lines
No EOL
794 B
Ruby

describe String, "#snake_case" do
it "lowercases one word CamelCase" do
"Merb".snake_case.should == "merb"
end
it "makes one underscore snake_case two word CamelCase" do
"MerbCore".snake_case.should == "merb_core"
end
it "handles CamelCase with more than 2 words" do
"SoYouWantContributeToMerbCore".snake_case.should == "so_you_want_contribute_to_merb_core"
end
it "handles CamelCase with more than 2 capital letter in a row" do
"CNN".snake_case.should == "cnn"
"CNNNews".snake_case.should == "cnn_news"
"HeadlineCNNNews".snake_case.should == "headline_cnn_news"
end
it "does NOT change one word lowercase" do
"merb".snake_case.should == "merb"
end
it "leaves snake_case as is" do
"merb_core".snake_case.should == "merb_core"
end
end