require 'spec_helper' describe LinkOracle::Extractor::Body do let(:parsed_body) { ::Nokogiri::HTML.parse(body) } let(:link_data) { LinkOracle::Extractor::Body.new(parsed_body).perform } let(:body) { <<-HTML TITLE!

Berkin

Derbin

Cherbin

paragraph 1

paragraph 2

paragraph 3

HTML } describe 'perform' do context 'there is no suitable stuff in the body' do let(:body) { " " } it 'should fail quietly' do expect { link_data }.to_not raise_error end end context 'there are body attributes' do it 'should populate link_data titles' do link_data.titles.should == [ 'Berkin', 'Derbin', 'Cherbin' ] end it 'should populate link_data image_urls' do link_data.image_urls.should == [ "http://berkin.com", "http://cherbin.com", "http://flerbin.com" ] end it 'should populate link_data descriptions' do link_data.descriptions.should == [ "paragraph 1", "paragraph 2", "paragraph 3" ] end end end end