acts_as_unvlogable_fork 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'acts_as_unvlogable'
@@ -3,3 +3,6 @@
3
3
  #
4
4
  # flickr =>
5
5
  flickr_key:
6
+
7
+ # youtube =>
8
+ youtube_key:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_unvlogable_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Muñoz
@@ -10,10 +10,24 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-20 00:00:00.000000000 Z
13
+ date: 2015-09-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: shoulda
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.3'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
17
31
  requirement: !ruby/object:Gem::Requirement
18
32
  requirements:
19
33
  - - ">="
@@ -27,7 +41,21 @@ dependencies:
27
41
  - !ruby/object:Gem::Version
28
42
  version: '0'
29
43
  - !ruby/object:Gem::Dependency
30
- name: xml-simple
44
+ name: rspec
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: nokogiri
31
59
  requirement: !ruby/object:Gem::Requirement
32
60
  requirements:
33
61
  - - ">="
@@ -41,7 +69,7 @@ dependencies:
41
69
  - !ruby/object:Gem::Version
42
70
  version: '0'
43
71
  - !ruby/object:Gem::Dependency
44
- name: youtube_it
72
+ name: xml-simple
45
73
  requirement: !ruby/object:Gem::Requirement
46
74
  requirements:
47
75
  - - ">="
@@ -55,7 +83,7 @@ dependencies:
55
83
  - !ruby/object:Gem::Version
56
84
  version: '0'
57
85
  - !ruby/object:Gem::Dependency
58
- name: hpricot
86
+ name: yt
59
87
  requirement: !ruby/object:Gem::Requirement
60
88
  requirements:
61
89
  - - ">="
@@ -72,13 +100,14 @@ description: An easy way to include external video services in a rails app. This
72
100
  provides you wrappers for the most common video services, such as Youtube, Vimeo,
73
101
  Flickr, and so on...
74
102
  email:
75
- - mamusino@gmail.com
103
+ - mamuso@mamuso.net
76
104
  - ferblape@gmail.com
77
105
  - denegro@gmail.com
78
106
  executables: []
79
107
  extensions: []
80
108
  extra_rdoc_files: []
81
109
  files:
110
+ - ".coveralls.yml"
82
111
  - ".gitignore"
83
112
  - ".travis.yml"
84
113
  - Gemfile
@@ -98,18 +127,17 @@ files:
98
127
  - lib/acts_as_unvlogable/vg_dailymotion.rb
99
128
  - lib/acts_as_unvlogable/vg_dalealplay.rb
100
129
  - lib/acts_as_unvlogable/vg_flickr.rb
101
- - lib/acts_as_unvlogable/vg_marca.rb
102
130
  - lib/acts_as_unvlogable/vg_metacafe.rb
103
131
  - lib/acts_as_unvlogable/vg_myspace.rb
104
- - lib/acts_as_unvlogable/vg_prostopleer.rb
105
- - lib/acts_as_unvlogable/vg_qik.rb
132
+ - lib/acts_as_unvlogable/vg_pleer.rb
106
133
  - lib/acts_as_unvlogable/vg_rutube.rb
107
134
  - lib/acts_as_unvlogable/vg_ted.rb
108
135
  - lib/acts_as_unvlogable/vg_vimeo.rb
136
+ - lib/acts_as_unvlogable/vg_wistia.rb
109
137
  - lib/acts_as_unvlogable/vg_youtu.rb
110
138
  - lib/acts_as_unvlogable/vg_youtube.rb
111
- - test/acts_as_unvlogable_test.rb
112
- - test/video_factory_test.rb
139
+ - spec/acts_as_unvlogable_spec.rb
140
+ - spec/spec_helper.rb
113
141
  - unvlogable_sample.yml
114
142
  homepage: https://github.com/mamuso/acts_as_unvlogable
115
143
  licenses: []
@@ -122,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
150
  requirements:
123
151
  - - ">="
124
152
  - !ruby/object:Gem::Version
125
- version: '0'
153
+ version: 1.9.3
126
154
  required_rubygems_version: !ruby/object:Gem::Requirement
127
155
  requirements:
128
156
  - - ">="
@@ -134,4 +162,6 @@ rubygems_version: 2.4.1
134
162
  signing_key:
135
163
  specification_version: 4
136
164
  summary: An easy way to include external video services in a rails app
137
- test_files: []
165
+ test_files:
166
+ - spec/acts_as_unvlogable_spec.rb
167
+ - spec/spec_helper.rb
@@ -1,48 +0,0 @@
1
- # ----------------------------------------------
2
- # Class for Marca.tv (www.marca.tv)
3
- # http://www.marca.com/tv/?v=DN23wG8c1Rj
4
- # ----------------------------------------------
5
-
6
-
7
- class VgMarca
8
-
9
- def initialize(url=nil, options={})
10
- @url = url
11
- @video_id = @url.query_param('v')
12
- res = Net::HTTP.get(URI.parse("http://estaticos.marca.com/consolamultimedia/marcaTV/elementos/#{@video_id[0,1]}/#{@video_id[1,1]}/#{@video_id[2,100]}.xml"))
13
- @feed = REXML::Document.new(res)
14
- end
15
-
16
- def title
17
- REXML::XPath.first( @feed, "//titulo" )[0].to_s
18
- end
19
-
20
- def thumbnail
21
- REXML::XPath.first( @feed, "//foto" )[0].to_s
22
- end
23
-
24
- def duration
25
- nil
26
- end
27
-
28
- def embed_url
29
- "http://www.marca.com/componentes/flash/embed.swf?ba=0&cvol=1&bt=1&lg=1&vID=#{@video_id}&ba=1"
30
- end
31
-
32
- def embed_html(width=425, height=344, options={}, params={})
33
- "<embed width='#{width}' height='#{height}' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' allowfullscreen='true' quality='high' src='#{embed_url}'/>"
34
- end
35
-
36
- def flv
37
- REXML::XPath.first(@feed, "//media")[0].to_s
38
- end
39
-
40
- def download_url
41
- nil
42
- end
43
-
44
- def service
45
- "Marca.tv"
46
- end
47
-
48
- end
@@ -1,64 +0,0 @@
1
- # ----------------------------------------------
2
- # Class for Qik (qik.com)
3
- # http://qik.com/video/340982
4
- # ----------------------------------------------
5
-
6
-
7
- class VgQik
8
-
9
- def initialize(url=nil, options={})
10
- @url = url
11
- @video_id = parse_url(url)
12
- h = {"Content-Type" => "application/json"}
13
- @page = Net::HTTP.start("engine.qik.com", "80") do |connection|
14
- JSON.parse(connection.post("/api/jsonrpc?apikey=e53d41680124e6d0", {:method => "qik.stream.public_info", :params => [340982]}.to_json, h).body)
15
- end
16
- end
17
-
18
- def title
19
- @page[0]['title']
20
- end
21
-
22
- def thumbnail
23
- @page[0]['large_thumbnail_url']
24
- end
25
-
26
- def embed_url
27
- "http://qik.com/swfs/qikPlayer5.swf?streamID=#{@page[0]['embed_html'].split("streamID=")[1].split("&")[0]}&amp;autoplay=false"
28
- end
29
-
30
- def embed_html(width=425, height=344, options={}, params={})
31
- @page[0]['embed_html']
32
- end
33
-
34
- def flv
35
- "http://media.qik.com/vod/flvs-play?assetId=#{@page[0]['embed_html'].split("streamID=")[1].split("&")[0]}&profile=flvs-normal"
36
- end
37
-
38
- def download_url
39
- nil
40
- end
41
-
42
- def duration
43
- nil
44
- end
45
-
46
- def service
47
- "Qik"
48
- end
49
-
50
- protected
51
-
52
- def parse_url(url)
53
- video_id = nil
54
- if url.split('#').size > 1
55
- pieces = url.split(/#|=/)
56
- hash = Hash[*pieces]
57
- video_id = hash['v']
58
- else
59
- video_id = url.split("/")[4]
60
- end
61
- video_id
62
- end
63
-
64
- end
@@ -1,392 +0,0 @@
1
- # encoding: utf-8
2
- require 'test/unit'
3
-
4
- $LOAD_PATH << File.dirname(__FILE__) + '/../lib'
5
- # Main class
6
- require 'acts_as_unvlogable'
7
- # Gems & other herbs
8
- require 'shoulda'
9
- require 'ruby-debug'
10
-
11
- class ActsAsUnvlogableTest < Test::Unit::TestCase
12
-
13
- context "Instancing UnvlogIt" do
14
-
15
- context "without any url" do
16
- should "raise an ArgumentError exception" do
17
- assert_raise(ArgumentError, "We need a video url") { UnvlogIt.new }
18
- end
19
- end
20
-
21
- context "with an unsupported url" do
22
- should "raise an ArgumentError exception" do
23
- assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://iwannagothere.net/") }
24
- end
25
- end
26
-
27
- # ----------------------------------------------------------
28
- # Testing youtube
29
- # ----------------------------------------------------------
30
- context "with an existent youtube url" do
31
- setup do
32
- @videotron = UnvlogIt.new("http://www.youtube.com/watch?v=MVa4q-YVjD8") # => Keith Moon´s drum kit explodes
33
- end
34
- should "initialize a VgYoutube instance" do
35
- assert_equal VgYoutube, @videotron.instance_values['object'].class
36
- assert_equal "http://www.youtube.com/watch?v=MVa4q-YVjD8", @videotron.instance_values['object'].instance_values['url']
37
- assert_equal "MVa4q-YVjD8", @videotron.instance_values['object'].instance_values['video_id']
38
- assert_not_nil @videotron.instance_values['object'].instance_values['details']
39
- end
40
-
41
- should "return the video properties" do
42
- check_video_attributes({:title => "Keith Moon´s drum kit explodes", :service => "Youtube"})
43
- end
44
- end
45
-
46
- context "with an existent youtube url that can not be embedded" do
47
- should "raise an ArgumentError" do
48
- assert_raise(ArgumentError, "Embedding disabled by request") { UnvlogIt.new("http://www.youtube.com/watch?v=6TT19cB0NTM") }# => Oh! Yeah! by Chickenfoot from the Tonight Show w Conan O'Brien
49
- end
50
- end
51
-
52
- context "with an inexistent youtube url" do
53
- should "raise an ArgumentError" do
54
- assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://www.youtube.com/watch?v=inexistente") }
55
- end
56
- end
57
-
58
- # ----------------------------------------------------------
59
- # Testing metacafe
60
- # ----------------------------------------------------------
61
- context "with an existent metacafe url" do
62
- setup do
63
- @videotron = UnvlogIt.new("http://www.metacafe.com/watch/1135061/close_call_a320_caught_in_crosswinds/") # => Close Call! A320 Caught in Crosswinds
64
- end
65
- should "initialize a VgMetacafe instance" do
66
- assert_equal VgMetacafe, @videotron.instance_values['object'].class
67
- assert_equal "http://www.metacafe.com/watch/1135061/close_call_a320_caught_in_crosswinds/", @videotron.instance_values['object'].instance_values['url']
68
- assert_equal 3, @videotron.instance_values['object'].instance_values['args'].size
69
- assert !@videotron.instance_values['object'].instance_values['youtubed']
70
- assert_nil @videotron.instance_values['object'].instance_values['yt']
71
- end
72
-
73
- should "return the video properties" do
74
- check_video_attributes({:title => "Close call a320 caught in crosswinds", :service => "Metacafe"})
75
- end
76
- end
77
-
78
- context "with an existent 'youtubed' metacafe url" do
79
- setup do
80
- @videotron = UnvlogIt.new("http://www.metacafe.com/watch/yt-r07zdVLOWBA/pop_rocks_and_coke_myth/") # => Close Call! A320 Caught in Crosswinds
81
- end
82
- should "initialize a VgMetacafe instance" do
83
- assert_equal VgMetacafe, @videotron.instance_values['object'].class
84
- assert_equal "http://www.metacafe.com/watch/yt-r07zdVLOWBA/pop_rocks_and_coke_myth/", @videotron.instance_values['object'].instance_values['url']
85
- assert_equal 3, @videotron.instance_values['object'].instance_values['args'].size
86
- assert @videotron.instance_values['object'].instance_values['youtubed']
87
- assert "VgYoutube", @videotron.instance_values['object'].instance_values['yt'].class.to_s
88
- end
89
-
90
- should "return the video properties" do
91
- check_video_attributes({:title => "Pop Rocks and Coke Myth", :service => "Metacafe"})
92
- end
93
- end
94
-
95
-
96
- end
97
-
98
-
99
- # ----------------------------------------------------------
100
- # Testing dailymotion
101
- # ----------------------------------------------------------
102
- context "with a dailymotion video url" do
103
- setup do
104
- @videotron = UnvlogIt.new("http://www.dailymotion.com/video/x7u5kn_parkour-dayyy_sport") # => parkour dayyy
105
- end
106
- should "initialize a VgDailymotion instance" do
107
- assert_equal "VgDailymotion", @videotron.instance_values['object'].class.to_s
108
- assert_equal "http://www.dailymotion.com/video/x7u5kn_parkour-dayyy_sport", @videotron.instance_values['object'].instance_values['url']
109
- assert_equal "x7u5kn_parkour-dayyy_sport", @videotron.instance_values['object'].instance_values['video_id']
110
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
111
- end
112
-
113
- should "return the video properties" do
114
- check_video_attributes({:title => "parkour dayyy", :service => "Dailymotion"})
115
- end
116
- end
117
-
118
-
119
-
120
- # ----------------------------------------------------------
121
- # Testing collegehumor
122
- # ----------------------------------------------------------
123
- context "with a collegehumor video url" do
124
- setup do
125
- @videotron = UnvlogIt.new("http://www.collegehumor.com/video/3005349/brohemian-rhapsody") # => Brohemian Rhapsody
126
- end
127
- should "initialize a VgCollegehumor instance" do
128
- assert_equal "VgCollegehumor", @videotron.instance_values['object'].class.to_s
129
- assert_equal "http://www.collegehumor.com/video/3005349/brohemian-rhapsody", @videotron.instance_values['object'].instance_values['url']
130
- assert_equal "3005349", @videotron.instance_values['object'].instance_values['video_id']
131
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
132
- end
133
-
134
- should "return the video properties" do
135
- check_video_attributes({:title => "Brohemian Rhapsody", :service => "CollegeHumor"})
136
- end
137
- end
138
-
139
-
140
- # ----------------------------------------------------------
141
- # Testing blip.tv
142
- # ----------------------------------------------------------
143
- context "with a blip.tv video url" do
144
- setup do
145
- @videotron = UnvlogIt.new("http://blip.tv/file/678407/") # => Toy Break 26 : Adult Toys
146
- end
147
- should "initialize a VgBlip instance" do
148
- assert_equal "VgBlip", @videotron.instance_values['object'].class.to_s
149
- assert_equal "http://blip.tv/file/678407/", @videotron.instance_values['object'].instance_values['url']
150
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
151
- end
152
-
153
- should "return the video properties" do
154
- check_video_attributes({:title => "Toy Break 26 : Adult Toys", :service => "Blip.tv"})
155
- end
156
- end
157
-
158
-
159
- # ----------------------------------------------------------
160
- # Testing vids.myspace.com
161
- # ----------------------------------------------------------
162
- context "with a vids.myspace.com video url" do
163
- setup do
164
- @videotron = UnvlogIt.new("http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=27111431") # => rocabilis
165
- end
166
- should "initialize a VgMyspace instance" do
167
- assert_equal "VgMyspace", @videotron.instance_values['object'].class.to_s
168
- assert_equal "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=27111431", @videotron.instance_values['object'].instance_values['url']
169
- assert_equal "27111431", @videotron.instance_values['object'].instance_values['video_id']
170
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
171
- end
172
-
173
- should "return the video properties" do
174
- check_video_attributes({:title => "rocabilis", :service => "Myspace"})
175
- end
176
- end
177
-
178
-
179
- # ----------------------------------------------------------
180
- # Testing 11870.com
181
- # ----------------------------------------------------------
182
- context "with an 11870.com video url" do
183
- setup do
184
- @videotron = UnvlogIt.new("http://11870.com/pro/chic-basic-born/media/b606abfe") # => Chic & Basic Born
185
- end
186
- should "initialize a Vg11870 instance" do
187
- assert_equal "Vg11870", @videotron.instance_values['object'].class.to_s
188
- assert_equal "http://11870.com/pro/chic-basic-born/media/b606abfe", @videotron.instance_values['object'].instance_values['url']
189
- assert_not_nil @videotron.instance_values['object'].instance_values['page']
190
- assert_not_nil @videotron.instance_values['object'].instance_values['flashvars']
191
- end
192
-
193
- should "return the video properties" do
194
- check_video_attributes({:title => "Chic & Basic Born", :service => "11870.com"})
195
- end
196
- end
197
-
198
-
199
- # ----------------------------------------------------------
200
- # Testing dalealplay.com
201
- # ----------------------------------------------------------
202
- context "with a dalealplay.com video url" do
203
- setup do
204
- @videotron = UnvlogIt.new("http://www.dalealplay.com/informaciondecontenido.php?con=80280") # => Camelos Semos Jonathan Tú si que vales
205
- end
206
- should "initialize a VgDalealplay instance" do
207
- assert_equal "VgDalealplay", @videotron.instance_values['object'].class.to_s
208
- assert_equal "http://www.dalealplay.com/informaciondecontenido.php?con=80280", @videotron.instance_values['object'].instance_values['url']
209
- assert_equal "80280", @videotron.instance_values['object'].instance_values['video_id']
210
- assert_not_nil @videotron.instance_values['object'].instance_values['page']
211
- end
212
-
213
- should "return the video properties" do
214
- check_video_attributes({:title => "Camelos.Semos. Jonathan. Tú si que vales.", :service => "dalealplay"})
215
- end
216
- end
217
-
218
-
219
-
220
- # ----------------------------------------------------------
221
- # Testing flickr.com
222
- # ----------------------------------------------------------
223
- context "with a flickr.com video url" do
224
- setup do
225
- @videotron = UnvlogIt.new("http://www.flickr.com/photos/jerovital/4152225414/", {:key => "065b2eff5e604e2a408c01af1f27a982" }) # => la primera vela
226
- end
227
- should "initialize a VgFlickr instance" do
228
- assert_equal "VgFlickr", @videotron.instance_values['object'].class.to_s
229
- assert_equal "http://www.flickr.com/photos/jerovital/4152225414/", @videotron.instance_values['object'].instance_values['url']
230
- assert_equal "4152225414", @videotron.instance_values['object'].instance_values['video_id']
231
- assert_not_nil @videotron.instance_values['object'].instance_values['details']
232
- end
233
-
234
- should "return the video properties" do
235
- check_video_attributes({:title => "flipando en los columpios", :service => "Flickr"})
236
- end
237
- end
238
-
239
-
240
- # ----------------------------------------------------------
241
- # Testing qik.com
242
- # ----------------------------------------------------------
243
- context "with a qik.com video url" do
244
- setup do
245
- @videotron = UnvlogIt.new("http://qik.com/video/340982") # => Honolulu Day 8: USS Arizona at Pearl Harbor
246
- end
247
- should "initialize a VgQik instance" do
248
- assert_equal "VgQik", @videotron.instance_values['object'].class.to_s
249
- assert_equal "http://qik.com/video/340982", @videotron.instance_values['object'].instance_values['url']
250
- assert_equal "340982", @videotron.instance_values['object'].instance_values['video_id']
251
- assert_not_nil @videotron.instance_values['object'].instance_values['page']
252
- end
253
-
254
- should "return the video properties" do
255
- check_video_attributes({:title => "Honolulu Day 8: USS Arizona at Pearl Harbor", :service => "Qik"})
256
- end
257
- end
258
-
259
-
260
-
261
- # ----------------------------------------------------------
262
- # Testing www.marca.tv
263
- # ----------------------------------------------------------
264
- context "with a www.marca.tv video url" do
265
- setup do
266
- @videotron = UnvlogIt.new("http://www.marca.com/tv/?v=DN23wG8c1Rj") # => Pau entra por la puerta grande en el club de los 10.000
267
- end
268
- should "initialize a VgMarca instance" do
269
- assert_equal "VgMarca", @videotron.instance_values['object'].class.to_s
270
- assert_equal "http://www.marca.com/tv/?v=DN23wG8c1Rj", @videotron.instance_values['object'].instance_values['url']
271
- assert_equal "DN23wG8c1Rj", @videotron.instance_values['object'].instance_values['video_id']
272
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
273
- end
274
-
275
- should "return the video properties" do
276
- check_video_attributes({:title => "Pau entra por la puerta grande en el club de los 10.000", :service => "Marca.tv"})
277
- end
278
- end
279
-
280
-
281
-
282
- # ----------------------------------------------------------
283
- # Testing ted talks
284
- # ----------------------------------------------------------
285
- context "with a ted talks video url" do
286
- setup do
287
- @videotron = UnvlogIt.new("http://www.ted.com/talks/benjamin_wallace_on_the_price_of_happiness.html") # => Benjamin Wallace: Does happiness have a price tag?
288
- end
289
- should "initialize a VgTed instance" do
290
- assert_equal "VgTed", @videotron.instance_values['object'].class.to_s
291
- assert_equal "http://www.ted.com/talks/benjamin_wallace_on_the_price_of_happiness.html", @videotron.instance_values['object'].instance_values['url']
292
- assert_not_nil @videotron.instance_values['object'].instance_values['page']
293
- assert_not_nil @videotron.instance_values['object'].instance_values['flashvars']
294
- assert_not_nil @videotron.instance_values['object'].instance_values['args']
295
- end
296
-
297
- should "return the video properties" do
298
- check_video_attributes({:title => "Benjamin Wallace: The price of happiness", :service => "Ted Talks"})
299
- end
300
- end
301
-
302
- context "with an invalid ted talks video url" do
303
- should "raise an ArgumentError exception" do
304
- assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://www.ted.com/index.php/wadus.html") }
305
- end
306
- end
307
-
308
-
309
- # ----------------------------------------------------------
310
- # Testing vimeo
311
- # ----------------------------------------------------------
312
- context "with a vimeo video url" do
313
- setup do
314
- @videotron = UnvlogIt.new("http://vimeo.com/2354261") # => People are strange
315
- end
316
- should "initialize a VgVimeo instance" do
317
- assert_equal "VgVimeo", @videotron.instance_values['object'].class.to_s
318
- assert_equal "http://vimeo.com/2354261", @videotron.instance_values['object'].instance_values['url']
319
- assert_equal "2354261", @videotron.instance_values['object'].instance_values['video_id']
320
- assert_not_nil @videotron.instance_values['object'].instance_values['feed']
321
- end
322
-
323
- should "return the video properties" do
324
- check_video_attributes({:title => "People are strange", :service => "Vimeo"})
325
- end
326
- end
327
-
328
- # ----------------------------------------------------------
329
- # Testing RuTube
330
- # ----------------------------------------------------------
331
- context "with a rutube video url" do
332
- setup do
333
- @videotron = UnvlogIt.new("http://rutube.ru/tracks/1958807.html?v=56cd2f1b50a4d2b69ff455e72f2fae29") # => chipmunks!!
334
- end
335
- should "initialize a VgRutube instance" do
336
- assert_equal "VgRutube", @videotron.instance_values['object'].class.to_s
337
- assert_equal "http://rutube.ru/tracks/1958807.html?v=56cd2f1b50a4d2b69ff455e72f2fae29", @videotron.instance_values['object'].instance_values['url']
338
- assert_equal "1958807", @videotron.instance_values['object'].instance_values['movie_id']
339
- assert_equal "56cd2f1b50a4d2b69ff455e72f2fae29", @videotron.instance_values['object'].send(:movie_hash)
340
- end
341
-
342
- should "return the video properties" do
343
- check_video_attributes({:title => "Запасливые бурундуки"})
344
- end
345
- end
346
-
347
- context "with an invalid rutube video url" do
348
- should "raise an ArgumentError exception" do
349
- assert_raise(ArgumentError, "Unsuported url or service") { UnvlogIt.new("http://rutube.ru/tracks/abdcd.html?v=523423") }
350
- end
351
- end
352
-
353
- # ----------------------------------------------------------
354
- # Testing Prostopleer
355
- # ----------------------------------------------------------
356
- context "with a prostopleer url" do
357
- setup do
358
- @videotron = UnvlogIt.new("http://prostopleer.com/tracks/401758bI6n")
359
- end
360
- should "initialize a VgProstopleer instance" do
361
- assert_equal "VgProstopleer", @videotron.instance_values['object'].class.to_s
362
- assert_equal "http://prostopleer.com/tracks/401758bI6n", @videotron.instance_values['object'].instance_values['url']
363
- assert_equal "401758bI6n", @videotron.instance_values['object'].instance_values['track_id']
364
- assert_equal "Combichrist - sent to destroy", @videotron.title
365
- end
366
- end
367
-
368
- context "with an invalid prostopleer url" do
369
- should "raise an ArgumentError exception" do
370
- assert_raise(ArgumentError) { UnvlogIt.new("http://prostopleer.com/trackszz/401758bI6n") }
371
- end
372
- end
373
-
374
- protected
375
-
376
- def check_video_attributes(options={})
377
- assert_equal "#{options[:title]}", @videotron.title unless (options.blank? || options[:title].blank?)
378
- assert_equal "#{options[:service]}", @videotron.service unless (options.blank? || options[:service].blank?)
379
- assert_not_nil @videotron.thumbnail
380
- if options.blank? || options[:noembed].blank?
381
- assert_not_nil @videotron.embed_url
382
- assert_not_nil @videotron.embed_html
383
- elsif options[:noembed]
384
- assert_nil @videotron.embed_url
385
- assert_nil @videotron.embed_html
386
- assert_nil @videotron.video_details[:embed_url]
387
- assert_nil @videotron.video_details[:embed_html]
388
- end
389
- assert_not_nil @videotron.flv
390
- assert_equal Hash, @videotron.video_details.class
391
- end
392
- end