require 'spec_helper' describe Hexp, 'parse' do context 'with an empty document' do let(:html) { '' } it 'should raise an exception' do expect{ Hexp.parse(html) }.to raise_exception Hexp::ParseError end end it 'should parse a single tag' do expect(Hexp.parse('Hello!')).to eq H[:a, 'Hello!'] end it 'should parse nested tags' do expect(Hexp.parse('Ciao Bella')).to eq H[:a, ['Ciao ', H[:em, 'Bella']]] end it 'should parse attributes' do expect(Hexp.parse('Ciao Bella')).to eq H[:a, {href: 'pretty'}, 'Ciao Bella'] end end