Skip to content

Commit

Permalink
Reset @@parser in between specs
Browse files Browse the repository at this point in the history
This fixes specs on JRuby.
  • Loading branch information
koraktor committed Apr 17, 2012
1 parent 61629a3 commit b562bed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/multi_xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ParseError < StandardError; end
class << self
# Get the current parser class.
def parser
return @@parser if defined?(@@parser)
return @@parser unless @@parser.nil?
self.parser = self.default_parser
@@parser
end
Expand Down
4 changes: 4 additions & 0 deletions spec/multi_xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class MockDecoder; end

describe "MultiXml" do
context "Parsers" do
before do
MultiXml.send :class_variable_set, :@@parser, nil
end

it "should pick a default parser" do
MultiXml.parser.should be_kind_of(Module)
MultiXml.parser.should respond_to(:parse)
Expand Down

0 comments on commit b562bed

Please sign in to comment.