Sha256: 3accc4b79bfba3390e39f3b3c2760d10c504a792f1036e4e25ccf85fb87d6e89

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe ReverseAdoc do
  let(:input)    { File.read("spec/assets/unknown_tags.html") }
  let(:document) { Nokogiri::HTML(input) }
  let(:result)   { ReverseAdoc.convert(input) }

  context "with unknown_tags = :pass_through" do
    before { ReverseAdoc.config.unknown_tags = :pass_through }

    it { expect(result).to include "<bar>Foo with bar</bar>" }
  end

  context "with unknown_tags = :raise" do
    before { ReverseAdoc.config.unknown_tags = :raise }

    it { expect { result }.to raise_error(ReverseAdoc::UnknownTagError) }
  end

  context "with unknown_tags = :drop" do
    before { ReverseAdoc.config.unknown_tags = :drop }

    it { expect(result).to eq "" }
  end

  context "with unknown_tags = :bypass" do
    before { ReverseAdoc.config.unknown_tags = :bypass }

    it { expect(result).to eq "Foo with bar\n\n" }
  end

  context "with unknown_tags = :something_wrong" do
    before { ReverseAdoc.config.unknown_tags = :something_wrong }

    it {
      expect do
        result
      end.to raise_error(ReverseAdoc::InvalidConfigurationError)
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reverse_adoc-1.0.1 spec/components/unknown_tags_spec.rb
reverse_adoc-1.0.0 spec/components/unknown_tags_spec.rb