spec/parsing/xml_spec.rb in wayfarer-0.4.6 vs spec/parsing/xml_spec.rb in wayfarer-0.4.7
- old
+ new
@@ -1,25 +1,24 @@
# frozen_string_literal: true
require "spec_helpers"
-describe Wayfarer::Parsing::XML do
- subject(:parser) { Wayfarer::Parsing::XML }
+describe Wayfarer::Parsing::XML, ".parse" do
+ let(:xml) { "<span>Foobar</span>" }
+ subject(:doc) { Wayfarer::Parsing::XML.parse(xml, variant) }
- describe ".parse_html" do
- it "returns a Nokogiri::HTML::Document" do
- html_str = "<span>Foobar</span>"
- doc = parser.parse_html(html_str)
+ context "HTML" do
+ let(:variant) { :html }
- expect(doc).to be_a Nokogiri::HTML::Document
+ specify do
+ expect(doc).to be_a(Nokogiri::HTML::Document)
end
end
- describe ".parse_xml" do
- it "returns a Nokogiri::XML::Document" do
- xml_str = "<barqux>Foobar</barqux>"
- doc = parser.parse_xml(xml_str)
+ context "XML" do
+ let(:variant) { :xml }
- expect(doc).to be_a Nokogiri::XML::Document
+ specify do
+ expect(doc).to be_a(Nokogiri::XML::Document)
end
end
end