nokogiri doc check for avm::xmp
This commit is contained in:
parent
c4718535ae
commit
b703ee1a55
@ -24,6 +24,9 @@ module AVM
|
|||||||
|
|
||||||
def initialize(doc = nil)
|
def initialize(doc = nil)
|
||||||
@doc = doc || empty_xml_doc
|
@doc = doc || empty_xml_doc
|
||||||
|
|
||||||
|
raise StandardError.new('not a Nokogiri node') if !@doc.kind_of?(::Nokogiri::XML::Node)
|
||||||
|
|
||||||
ensure_namespaces!
|
ensure_namespaces!
|
||||||
ensure_descriptions_findable!
|
ensure_descriptions_findable!
|
||||||
end
|
end
|
||||||
|
@ -6,6 +6,14 @@ describe AVM::XMP do
|
|||||||
|
|
||||||
subject { xmp }
|
subject { xmp }
|
||||||
|
|
||||||
|
describe '#initialize' do
|
||||||
|
context 'not a nokogiri document' do
|
||||||
|
let(:xmp) { self.class.describes.new("definitely not nokogiri node") }
|
||||||
|
|
||||||
|
it { expect { xmp }.to raise_error(StandardError, /not a Nokogiri node/) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#get_refs' do
|
describe '#get_refs' do
|
||||||
before {
|
before {
|
||||||
xmp.get_refs do |refs|
|
xmp.get_refs do |refs|
|
||||||
|
Loading…
Reference in New Issue
Block a user