Skip to content
Browse files

added tests for crack's xml parser

  • Loading branch information...
1 parent a3cdc16 commit 9dd8cd210504c6204d3d059a745bc3eb2af913b6 @rubiii rubiii committed
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/parser_test.rb
View
27 test/parser_test.rb
@@ -0,0 +1,27 @@
+require 'test_helper'
+
+class ParserTest < Test::Unit::TestCase
+ should "default to REXMLParser" do
+ Crack::XML.parser.should == Crack::REXMLParser
+ end
+
+ context "with a custom Parser" do
+ class CustomParser
+ def self.parse(xml)
+ xml
+ end
+ end
+
+ setup do
+ Crack::XML.parser = CustomParser
+ end
+
+ should "use the custom Parser" do
+ Crack::XML.parse("<xml/>").should == "<xml/>"
+ end
+
+ teardown do
+ Crack::XML.parser = nil
+ end
+ end
+end

0 comments on commit 9dd8cd2

Please sign in to comment.
Something went wrong with that request. Please try again.