Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/hash_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

it "turn the hash into xml attributes" do
attrs = Crack::Util.to_xml_attributes(@hash)
attrs.must_match /one="ONE"/m
attrs.must_match /two="TWO"/m
attrs.must_match /three="it "should" work"/m
expect(attrs).must_match(/one="ONE"/m)
expect(attrs).must_match(/two="TWO"/m)
expect(attrs).must_match(/three="it "should" work"/m)
end

it "preserve _ in hash keys" do
Expand All @@ -19,8 +19,8 @@
:merb => "uses extlib"
})

attrs.must_match /some_long_attribute="with short value"/
attrs.must_match /merb="uses extlib"/
attrs.must_match /crash="burn"/
expect(attrs).must_match(/some_long_attribute="with short value"/)
expect(attrs).must_match(/merb="uses extlib"/)
expect(attrs).must_match(/crash="burn"/)
end
end
6 changes: 5 additions & 1 deletion test/json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@

TESTS.each do |json, expected|
it "decode json (#{json})" do
Crack::JSON.parse(json).must_equal expected
if expected.nil?
assert_nil(Crack::JSON.parse(json))
else
expect(Crack::JSON.parse(json)).must_equal expected
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe Crack::XML do
it "default to REXMLParser" do
Crack::XML.parser.must_equal Crack::REXMLParser
expect(Crack::XML.parser).must_equal Crack::REXMLParser
end

describe "with a custom Parser" do
Expand All @@ -17,7 +17,7 @@ def self.parse(xml)
end

it "use the custom Parser" do
Crack::XML.parse("<xml/>").must_equal "<xml/>"
expect(Crack::XML.parse("<xml/>")).must_equal "<xml/>"
end

after do
Expand Down
16 changes: 8 additions & 8 deletions test/string_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
describe Crack::Util do
describe "snake_case" do
it "lowercases one word CamelCase" do
Crack::Util.snake_case("Merb").must_equal "merb"
expect(Crack::Util.snake_case("Merb")).must_equal "merb"
end

it "makes one underscore snake_case two word CamelCase" do
Crack::Util.snake_case("MerbCore").must_equal "merb_core"
expect(Crack::Util.snake_case("MerbCore")).must_equal "merb_core"
end

it "handles CamelCase with more than 2 words" do
Crack::Util.snake_case("SoYouWantContributeToMerbCore").must_equal "so_you_want_contribute_to_merb_core"
expect(Crack::Util.snake_case("SoYouWantContributeToMerbCore")).must_equal "so_you_want_contribute_to_merb_core"
end

it "handles CamelCase with more than 2 capital letter in a row" do
Crack::Util.snake_case("CNN").must_equal "cnn"
Crack::Util.snake_case("CNNNews").must_equal "cnn_news"
Crack::Util.snake_case("HeadlineCNNNews").must_equal "headline_cnn_news"
expect(Crack::Util.snake_case("CNN")).must_equal "cnn"
expect(Crack::Util.snake_case("CNNNews")).must_equal "cnn_news"
expect(Crack::Util.snake_case("HeadlineCNNNews")).must_equal "headline_cnn_news"
end

it "does NOT change one word lowercase" do
Crack::Util.snake_case("merb").must_equal "merb"
expect(Crack::Util.snake_case("merb")).must_equal "merb"
end

it "leaves snake_case as is" do
Crack::Util.snake_case("merb_core").must_equal "merb_core"
expect(Crack::Util.snake_case("merb_core")).must_equal "merb_core"
end
end
end
Loading