Setup

Create new onebox engine

# in lib/onebox/engine/name_onebox.rbmoduleOneboxmoduleEngineclassNameOneboxincludeEngineincludeHTMLprivatedefdata{url:@url,name:raw.css("h1").inner_text,image:raw.css("#main-image").first["src"],description:raw.css("#postBodyPS").inner_text}endendendend

Create new onebox spec

# in spec/lib/onebox/engine/name_spec.rbrequire"spec_helper"describeOnebox::Engine::NameOneboxdolet(:link){"http://yoursitename.com"}let(:html){described_class.new(link).to_html}beforedofake(link,response("name.response"))endit"has the video's title"doexpect(html).toinclude("title")endit"has the video's still shot"doexpect(html).toinclude("photo.jpg")endit"has the video's description"doexpect(html).toinclude("description")endit"has the URL to the resource"doexpect(html).toinclude(link)endend