Sha256: ee84e7e2c9730472e80f422edd94dbdec2a10e306be86ff0c6ea648637a84125
Contents?: true
Size: 1.42 KB
Versions: 8
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' describe LinkOracle::Extractor::Meta do let(:parsed_body) { ::Nokogiri::HTML.parse(body) } let(:link_data) { LinkOracle::Extractor::Meta.new(parsed_body).perform } let(:body) { "<html> <head> <meta property=\"og:title\" content=\"This is a title\"> <meta property=\"og:description\" content=\"A description for your face\"> <meta property=\"og:image\" content=\"http://imageurl.com\"> <meta name=\"Description\" content=\"Here is a description not for facebook\"> <meta name=\"KEYWORDS\" content=\"Keywords, Keywords everywhere\"> <title>TITLE!</title> <meta itemprop='thumbnailUrl' name='thumbnail' content='http://imageurlfrommeta.com'> </head> </html>" } describe 'perform' do context 'there is no suitable meta data' do let(:body) { "<html> <head> </head> </html>" } it 'should fail quietly' do expect { link_data }.to_not raise_error end end context 'there is meta data' do it 'should populate link_data title' do link_data.title.should == 'TITLE!' end it 'should populate link_data image_url' do link_data.image_url.should == "http://imageurlfrommeta.com" end it 'should populate link_data description' do link_data.description.should == 'Here is a description not for facebook' end end end end
Version data entries
8 entries across 8 versions & 1 rubygems