File tree Expand file tree Collapse file tree 5 files changed +80
-68
lines changed
Expand file tree Collapse file tree 5 files changed +80
-68
lines changed Original file line number Diff line number Diff line change 77
88 it "turn the hash into xml attributes" do
99 attrs = Crack ::Util . to_xml_attributes ( @hash )
10- attrs . must_match /one="ONE"/m
11- attrs . must_match /two="TWO"/m
12- attrs . must_match /three="it "should" work"/m
10+ expect ( attrs ) . must_match ( /one="ONE"/m )
11+ expect ( attrs ) . must_match ( /two="TWO"/m )
12+ expect ( attrs ) . must_match ( /three="it "should" work"/m )
1313 end
1414
1515 it "preserve _ in hash keys" do
1919 :merb => "uses extlib"
2020 } )
2121
22- attrs . must_match /some_long_attribute="with short value"/
23- attrs . must_match /merb="uses extlib"/
24- attrs . must_match /crash="burn"/
22+ expect ( attrs ) . must_match ( /some_long_attribute="with short value"/ )
23+ expect ( attrs ) . must_match ( /merb="uses extlib"/ )
24+ expect ( attrs ) . must_match ( /crash="burn"/ )
2525 end
2626end
Original file line number Diff line number Diff line change 4747
4848 TESTS . each do |json , expected |
4949 it "decode json (#{ json } )" do
50- Crack ::JSON . parse ( json ) . must_equal expected
50+ if expected . nil?
51+ assert_nil ( Crack ::JSON . parse ( json ) )
52+ else
53+ expect ( Crack ::JSON . parse ( json ) ) . must_equal expected
54+ end
5155 end
5256 end
5357
Original file line number Diff line number Diff line change 22
33describe Crack ::XML do
44 it "default to REXMLParser" do
5- Crack ::XML . parser . must_equal Crack ::REXMLParser
5+ expect ( Crack ::XML . parser ) . must_equal Crack ::REXMLParser
66 end
77
88 describe "with a custom Parser" do
@@ -17,7 +17,7 @@ def self.parse(xml)
1717 end
1818
1919 it "use the custom Parser" do
20- Crack ::XML . parse ( "<xml/>" ) . must_equal "<xml/>"
20+ expect ( Crack ::XML . parse ( "<xml/>" ) ) . must_equal "<xml/>"
2121 end
2222
2323 after do
Original file line number Diff line number Diff line change 33describe Crack ::Util do
44 describe "snake_case" do
55 it "lowercases one word CamelCase" do
6- Crack ::Util . snake_case ( "Merb" ) . must_equal "merb"
6+ expect ( Crack ::Util . snake_case ( "Merb" ) ) . must_equal "merb"
77 end
88
99 it "makes one underscore snake_case two word CamelCase" do
10- Crack ::Util . snake_case ( "MerbCore" ) . must_equal "merb_core"
10+ expect ( Crack ::Util . snake_case ( "MerbCore" ) ) . must_equal "merb_core"
1111 end
1212
1313 it "handles CamelCase with more than 2 words" do
14- Crack ::Util . snake_case ( "SoYouWantContributeToMerbCore" ) . must_equal "so_you_want_contribute_to_merb_core"
14+ expect ( Crack ::Util . snake_case ( "SoYouWantContributeToMerbCore" ) ) . must_equal "so_you_want_contribute_to_merb_core"
1515 end
1616
1717 it "handles CamelCase with more than 2 capital letter in a row" do
18- Crack ::Util . snake_case ( "CNN" ) . must_equal "cnn"
19- Crack ::Util . snake_case ( "CNNNews" ) . must_equal "cnn_news"
20- Crack ::Util . snake_case ( "HeadlineCNNNews" ) . must_equal "headline_cnn_news"
18+ expect ( Crack ::Util . snake_case ( "CNN" ) ) . must_equal "cnn"
19+ expect ( Crack ::Util . snake_case ( "CNNNews" ) ) . must_equal "cnn_news"
20+ expect ( Crack ::Util . snake_case ( "HeadlineCNNNews" ) ) . must_equal "headline_cnn_news"
2121 end
2222
2323 it "does NOT change one word lowercase" do
24- Crack ::Util . snake_case ( "merb" ) . must_equal "merb"
24+ expect ( Crack ::Util . snake_case ( "merb" ) ) . must_equal "merb"
2525 end
2626
2727 it "leaves snake_case as is" do
28- Crack ::Util . snake_case ( "merb_core" ) . must_equal "merb_core"
28+ expect ( Crack ::Util . snake_case ( "merb_core" ) ) . must_equal "merb_core"
2929 end
3030 end
3131end
You can’t perform that action at this time.
0 commit comments