Sha256: b11ed7d5fd7e74fbdbfa83f1d7f3db45c253fd76838dfb0634d8d09b6d034263
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe OpenGraph do let(:rotten){ File.open(File.dirname(__FILE__) + '/examples/rottentomatoes.html').read } describe '.parse' do it 'should return false if there isnt valid Open Graph info' do OpenGraph.parse("").should be_false end it 'should otherwise return an OpenGraph::Object' do OpenGraph.parse(rotten).should be_kind_of(OpenGraph::Object) end end describe '.fetch' do it 'should fetch from the specified URL' do stub_request(:get, 'http://www.rottentomatoes.com/m/1217700-kick_ass/').to_return(:body => rotten) OpenGraph.fetch('http://www.rottentomatoes.com/m/1217700-kick_ass/').title.should == 'Kick-Ass' WebMock.should have_requested(:get, 'http://www.rottentomatoes.com/m/1217700-kick_ass/') end end end describe OpenGraph::Object do let(:rotten){ File.open(File.dirname(__FILE__) + '/examples/rottentomatoes.html')} context ' a Rotten Tomatoes Movie' do subject{ OpenGraph.parse(rotten) } it 'should have the title' do subject.title.should == "Kick-Ass" end it 'should be a product' do subject.schema.should == 'product' subject.should be_product subject.should_not be_person end it 'should be a movie' do subject.type.should == 'movie' subject.should be_movie subject.should_not be_tv_show end it 'should be valid' do subject.should be_valid subject['type'] = nil subject.should_not be_valid end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opengraph-0.0.1 | spec/opengraph_spec.rb |