opengraph 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe OpenGraph do
4
+ let(:rotten){ File.open(File.dirname(__FILE__) + '/examples/rottentomatoes.html').read }
5
+
6
+ describe '.parse' do
7
+ it 'should return false if there isnt valid Open Graph info' do
8
+ OpenGraph.parse("").should be_false
9
+ end
10
+
11
+ it 'should otherwise return an OpenGraph::Object' do
12
+ OpenGraph.parse(rotten).should be_kind_of(OpenGraph::Object)
13
+ end
14
+ end
15
+
16
+ describe '.fetch' do
17
+ it 'should fetch from the specified URL' do
18
+ stub_request(:get, 'http://www.rottentomatoes.com/m/1217700-kick_ass/').to_return(:body => rotten)
19
+ OpenGraph.fetch('http://www.rottentomatoes.com/m/1217700-kick_ass/').title.should == 'Kick-Ass'
20
+ WebMock.should have_requested(:get, 'http://www.rottentomatoes.com/m/1217700-kick_ass/')
21
+ end
22
+ end
23
+ end
24
+
25
+ describe OpenGraph::Object do
26
+ let(:rotten){ File.open(File.dirname(__FILE__) + '/examples/rottentomatoes.html')}
27
+
28
+ context ' a Rotten Tomatoes Movie' do
29
+ subject{ OpenGraph.parse(rotten) }
30
+
31
+ it 'should have the title' do
32
+ subject.title.should == "Kick-Ass"
33
+ end
34
+
35
+ it 'should be a product' do
36
+ subject.schema.should == 'product'
37
+ subject.should be_product
38
+ subject.should_not be_person
39
+ end
40
+
41
+ it 'should be a movie' do
42
+ subject.type.should == 'movie'
43
+ subject.should be_movie
44
+ subject.should_not be_tv_show
45
+ end
46
+
47
+ it 'should be valid' do
48
+ subject.should be_valid
49
+ subject['type'] = nil
50
+ subject.should_not be_valid
51
+ end
52
+ end
53
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'opengraph'
6
+ require 'spec'
7
+ require 'spec/autorun'
8
+ require 'webmock/rspec'
9
+
10
+ include WebMock
11
+
12
+ Spec::Runner.configure do |config|
13
+
14
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opengraph
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Michael Bleigh
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-22 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: hashie
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: nokogiri
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 1
41
+ - 4
42
+ - 0
43
+ version: 1.4.0
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: rest-client
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 1
55
+ - 4
56
+ - 0
57
+ version: 1.4.0
58
+ type: :runtime
59
+ version_requirements: *id003
60
+ - !ruby/object:Gem::Dependency
61
+ name: rspec
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 1
69
+ - 2
70
+ - 9
71
+ version: 1.2.9
72
+ type: :development
73
+ version_requirements: *id004
74
+ - !ruby/object:Gem::Dependency
75
+ name: webmock
76
+ prerelease: false
77
+ requirement: &id005 !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ type: :development
85
+ version_requirements: *id005
86
+ description: A very simple Ruby library for parsing Open Graph prototocol information from websites. See http://opengraphprotocol.org for more information.
87
+ email: michael@intridea.com
88
+ executables: []
89
+
90
+ extensions: []
91
+
92
+ extra_rdoc_files:
93
+ - LICENSE
94
+ - README.rdoc
95
+ files:
96
+ - .document
97
+ - .gitignore
98
+ - LICENSE
99
+ - README.rdoc
100
+ - Rakefile
101
+ - VERSION
102
+ - lib/opengraph.rb
103
+ - spec/examples/rottentomatoes.html
104
+ - spec/opengraph_spec.rb
105
+ - spec/spec.opts
106
+ - spec/spec_helper.rb
107
+ has_rdoc: true
108
+ homepage: http://github.com/intridea/opengraph
109
+ licenses: []
110
+
111
+ post_install_message:
112
+ rdoc_options:
113
+ - --charset=UTF-8
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ requirements: []
131
+
132
+ rubyforge_project:
133
+ rubygems_version: 1.3.6
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: A very simple Ruby library for parsing Open Graph prototocol information from websites.
137
+ test_files:
138
+ - spec/opengraph_spec.rb
139
+ - spec/spec_helper.rb