Skip to content

Commit

Permalink
added tests for crack's xml parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Sep 18, 2011
1 parent a3cdc16 commit 9dd8cd2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 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.