multi_xml 0.5.5 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +54 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +5 -3
- data/Gemfile +21 -0
- data/LICENSE.md +1 -1
- data/README.md +12 -35
- data/Rakefile +27 -15
- data/lib/multi_xml/parsers/libxml.rb +12 -9
- data/lib/multi_xml/parsers/libxml2_parser.rb +21 -25
- data/lib/multi_xml/parsers/nokogiri.rb +14 -10
- data/lib/multi_xml/parsers/oga.rb +71 -0
- data/lib/multi_xml/parsers/ox.rb +16 -22
- data/lib/multi_xml/parsers/rexml.rb +16 -16
- data/lib/multi_xml/version.rb +1 -1
- data/lib/multi_xml.rb +127 -112
- metadata +37 -69
- data/multi_xml.gemspec +0 -24
- data/spec/helper.rb +0 -17
- data/spec/multi_xml_spec.rb +0 -43
- data/spec/parser_shared_example.rb +0 -694
- data/spec/speed.rb +0 -63
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
data/spec/helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'coveralls'
|
3
|
-
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
-
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
]
|
8
|
-
SimpleCov.start
|
9
|
-
|
10
|
-
require 'multi_xml'
|
11
|
-
require 'rspec'
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.expect_with :rspec do |c|
|
15
|
-
c.syntax = :expect
|
16
|
-
end
|
17
|
-
end
|
data/spec/multi_xml_spec.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'parser_shared_example'
|
3
|
-
|
4
|
-
class MockDecoder; end
|
5
|
-
|
6
|
-
describe "MultiXml" do
|
7
|
-
context "Parsers" do
|
8
|
-
it "picks a default parser" do
|
9
|
-
expect(MultiXml.parser).to be_kind_of(Module)
|
10
|
-
expect(MultiXml.parser).to respond_to(:parse)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "defaults to the best available gem" do
|
14
|
-
# Clear cache variable already set by previous tests
|
15
|
-
MultiXml.send(:remove_instance_variable, :@parser)
|
16
|
-
expect(MultiXml.parser.name).to eq('MultiXml::Parsers::Ox')
|
17
|
-
end
|
18
|
-
|
19
|
-
it "is settable via a symbol" do
|
20
|
-
MultiXml.parser = :rexml
|
21
|
-
expect(MultiXml.parser.name).to eq('MultiXml::Parsers::Rexml')
|
22
|
-
end
|
23
|
-
|
24
|
-
it "is settable via a class" do
|
25
|
-
MultiXml.parser = MockDecoder
|
26
|
-
expect(MultiXml.parser.name).to eq('MockDecoder')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
[['LibXML', 'libxml'],
|
31
|
-
['REXML', 'rexml/document'],
|
32
|
-
['Nokogiri', 'nokogiri'],
|
33
|
-
['Ox', 'ox']].each do |parser|
|
34
|
-
begin
|
35
|
-
require parser.last
|
36
|
-
context "#{parser.first} parser" do
|
37
|
-
it_behaves_like "a parser", parser.first
|
38
|
-
end
|
39
|
-
rescue LoadError => e
|
40
|
-
puts "Tests not run for #{parser.first} due to a LoadError"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|