32 lines
825 B
Ruby
32 lines
825 B
Ruby
require 'spec_helper'
|
|
|
|
describe Oga::EntityDecoder do
|
|
describe 'try_decode' do
|
|
it 'returns nil if the input is also nil' do
|
|
described_class.try_decode(nil).should be_nil
|
|
end
|
|
|
|
it 'decodes XML entities' do
|
|
described_class.try_decode('<')
|
|
.should == Oga::XML::Entities::DECODE_MAPPING['<']
|
|
end
|
|
|
|
it 'decodes HTML entities' do
|
|
described_class.try_decode('©', true)
|
|
.should == Oga::HTML::Entities::DECODE_MAPPING['©']
|
|
end
|
|
end
|
|
|
|
describe 'decode' do
|
|
it 'decodes XML entities' do
|
|
described_class.decode('<')
|
|
.should == Oga::XML::Entities::DECODE_MAPPING['<']
|
|
end
|
|
|
|
it 'decodes HTML entities' do
|
|
described_class.decode('©', true)
|
|
.should == Oga::HTML::Entities::DECODE_MAPPING['©']
|
|
end
|
|
end
|
|
end
|