Sha256: fed75b3ace002c3daba62ecd5954928020e9f7c4788c52129358797e3458e8f9

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require "spec_helpers"

describe Wayfarer::Page do
  describe "#doc" do
    context "when Content-Type is absent" do
      subject(:page) { build(:page, :html, headers: {}) }

      it "returns a Nokogiri::HTML::Document" do
        expect(page.doc).to be_a(Nokogiri::HTML::Document)
      end
    end

    context "when Content-Type is HTML" do
      subject(:page) { build(:page, :html) }

      it "returns a Nokogiri::HTML::Document" do
        expect(page.doc).to be_a(Nokogiri::HTML::Document)
      end
    end

    context "when Content-Type is XML" do
      subject(:page) { build(:page, :xml) }

      it "returns a Nokogiri::XML::Document" do
        expect(page.doc).to be_a(Nokogiri::XML::Document)
      end
    end

    context "when Content-Type is JSON" do
      subject(:page) { build(:page, :json) }

      it "returns a Hash" do
        expect(page.doc).to be_a(Hash)
      end
    end
  end

  describe "#meta" do
    subject(:page) { build(:page, :html) }

    it "returns a MetaInspector document" do
      expect(page.meta).to be_a(MetaInspector::Document)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wayfarer-0.4.6 spec/page_spec.rb
wayfarer-0.4.5 spec/page_spec.rb
wayfarer-0.4.4 spec/page_spec.rb
wayfarer-0.4.3 spec/page_spec.rb
wayfarer-0.4.2 spec/page_spec.rb
wayfarer-0.4.1 spec/page_spec.rb
wayfarer-0.4.0 spec/page_spec.rb