Sha256: 15f8f79fb2de5ecefc58e7dd45e91139005432c8d1e935da54b76511555253f3

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 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 { result }.to raise_error(ReverseAdoc::InvalidConfigurationError) }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reverse_adoc-0.3.7 spec/components/unknown_tags_spec.rb
reverse_adoc-0.3.6 spec/components/unknown_tags_spec.rb
reverse_adoc-0.3.5 spec/components/unknown_tags_spec.rb
reverse_adoc-0.3.4 spec/components/unknown_tags_spec.rb
reverse_adoc-0.3.3 spec/components/unknown_tags_spec.rb
reverse_adoc-0.3.1 spec/components/unknown_tags_spec.rb