Sha256: 54f00c6983b529bd705816d8de179aafd7b3652df5c40f13240e115d0a421fb0
Contents?: true
Size: 971 Bytes
Versions: 2
Compression:
Stored size: 971 Bytes
Contents
require 'spec_helper' require 'ronin/web/xml' describe Ronin::Web::XML do describe ".parse" do let(:xml) do <<~XML <?xml version="1.0"?> <root> <stuff>Hello</stuff> </root> XML end it "must parse an XML String and return a Nokogiri::XML::Document" do doc = subject.parse(xml) expect(doc).to be_kind_of(Nokogiri::XML::Document) expect(doc.at('stuff').inner_text).to eq("Hello") end context "when given a block" do it "must yield the Nokogiri::XML::Document object" do expect { |b| subject.parse(xml,&b) }.to yield_with_args(Nokogiri::XML::Document) end end end describe ".build" do it "must build an XML document" do doc = subject.build do root { stuff(name: 'bla') { text("hello") } } end expect(doc.to_xml).to include("<root>\n <stuff name=\"bla\">hello</stuff>\n</root>") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ronin-web-1.0.0.beta2 | spec/xml_spec.rb |
ronin-web-1.0.0.beta1 | spec/xml_spec.rb |