acts_as_unvlogable_2 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +16 -0
- data/Gemfile +14 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +130 -0
- data/Rakefile +2 -0
- data/acts_as_unvlogable.gemspec +25 -0
- data/lib/acts_as_unvlogable.rb +117 -0
- data/lib/acts_as_unvlogable/flickr.rb +713 -0
- data/lib/acts_as_unvlogable/object_base.rb +15 -0
- data/lib/acts_as_unvlogable/string_base.rb +24 -0
- data/lib/acts_as_unvlogable/string_extend.rb +8 -0
- data/lib/acts_as_unvlogable/version.rb +3 -0
- data/lib/acts_as_unvlogable/vg_11870.rb +48 -0
- data/lib/acts_as_unvlogable/vg_blip.rb +48 -0
- data/lib/acts_as_unvlogable/vg_collegehumor.rb +58 -0
- data/lib/acts_as_unvlogable/vg_dailymotion.rb +67 -0
- data/lib/acts_as_unvlogable/vg_dalealplay.rb +50 -0
- data/lib/acts_as_unvlogable/vg_flickr.rb +70 -0
- data/lib/acts_as_unvlogable/vg_marca.rb +48 -0
- data/lib/acts_as_unvlogable/vg_metacafe.rb +77 -0
- data/lib/acts_as_unvlogable/vg_myspace.rb +48 -0
- data/lib/acts_as_unvlogable/vg_prostopleer.rb +46 -0
- data/lib/acts_as_unvlogable/vg_qik.rb +64 -0
- data/lib/acts_as_unvlogable/vg_rutube.rb +80 -0
- data/lib/acts_as_unvlogable/vg_ted.rb +51 -0
- data/lib/acts_as_unvlogable/vg_vimeo.rb +89 -0
- data/lib/acts_as_unvlogable/vg_youtu.rb +11 -0
- data/lib/acts_as_unvlogable/vg_youtube.rb +67 -0
- data/test/acts_as_unvlogable_test.rb +392 -0
- data/test/video_factory_test.rb +66 -0
- data/unvlogable_sample.yml +5 -0
- metadata +137 -0
@@ -0,0 +1,66 @@
|
|
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 NoEmbedServiceDouble
|
12
|
+
def initialize
|
13
|
+
@details = self
|
14
|
+
end
|
15
|
+
|
16
|
+
def noembed
|
17
|
+
true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class ActsAsUnvlogableFactoryTest < Test::Unit::TestCase
|
22
|
+
context UnvlogIt::VideoFactory do
|
23
|
+
should "return a Vg service object" do
|
24
|
+
url = "http://vimeo.com/1234567"
|
25
|
+
service = UnvlogIt::VideoFactory.new(url).load_service
|
26
|
+
|
27
|
+
assert_equal VgVimeo, service.class
|
28
|
+
end
|
29
|
+
|
30
|
+
context "bad urls" do
|
31
|
+
should "raise an exception if no url is provided" do
|
32
|
+
assert_raise(ArgumentError) do
|
33
|
+
UnvlogIt::VideoFactory.new(nil)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# TODO this should be a NotImplementedError, but leaving as ArgumentError
|
38
|
+
# for backwards support.
|
39
|
+
should "raise an exception if we haven't implemented support for that URL" do
|
40
|
+
assert_raise(ArgumentError) do
|
41
|
+
UnvlogIt::VideoFactory.new("http://my-video-service.com/horse_apples").load_service
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
should "raise an exception if we have an invalid URL" do
|
46
|
+
# underscores are not permitted by URI::parse
|
47
|
+
assert_raise(URI::InvalidURIError) do
|
48
|
+
UnvlogIt::VideoFactory.new("http://my_video_service.com/horse_apples").load_service
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
should "raise an exception if our service object does not allow it" do
|
53
|
+
factory = UnvlogIt::VideoFactory.new("url")
|
54
|
+
|
55
|
+
# factory.stubs(:service_object).returns(service_double)
|
56
|
+
def factory.service_object
|
57
|
+
NoEmbedServiceDouble.new
|
58
|
+
end
|
59
|
+
|
60
|
+
assert_raise(ArgumentError, "Embedding disabled by request") do
|
61
|
+
factory.load_service
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_unvlogable_2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Manuel Muñoz
|
8
|
+
- Fernando Blat
|
9
|
+
- Alberto Romero
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-09-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: shoulda
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: xml-simple
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: youtube_it
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :runtime
|
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: hpricot
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
description: An easy way to include external video services in a rails app. This gem
|
72
|
+
provides you wrappers for the most common video services, such as Youtube, Vimeo,
|
73
|
+
Flickr, and so on...
|
74
|
+
email:
|
75
|
+
- mamusino@gmail.com
|
76
|
+
- ferblape@gmail.com
|
77
|
+
- denegro@gmail.com
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- ".gitignore"
|
83
|
+
- ".travis.yml"
|
84
|
+
- Gemfile
|
85
|
+
- MIT-LICENSE
|
86
|
+
- README.markdown
|
87
|
+
- Rakefile
|
88
|
+
- acts_as_unvlogable.gemspec
|
89
|
+
- lib/acts_as_unvlogable.rb
|
90
|
+
- lib/acts_as_unvlogable/flickr.rb
|
91
|
+
- lib/acts_as_unvlogable/object_base.rb
|
92
|
+
- lib/acts_as_unvlogable/string_base.rb
|
93
|
+
- lib/acts_as_unvlogable/string_extend.rb
|
94
|
+
- lib/acts_as_unvlogable/version.rb
|
95
|
+
- lib/acts_as_unvlogable/vg_11870.rb
|
96
|
+
- lib/acts_as_unvlogable/vg_blip.rb
|
97
|
+
- lib/acts_as_unvlogable/vg_collegehumor.rb
|
98
|
+
- lib/acts_as_unvlogable/vg_dailymotion.rb
|
99
|
+
- lib/acts_as_unvlogable/vg_dalealplay.rb
|
100
|
+
- lib/acts_as_unvlogable/vg_flickr.rb
|
101
|
+
- lib/acts_as_unvlogable/vg_marca.rb
|
102
|
+
- lib/acts_as_unvlogable/vg_metacafe.rb
|
103
|
+
- lib/acts_as_unvlogable/vg_myspace.rb
|
104
|
+
- lib/acts_as_unvlogable/vg_prostopleer.rb
|
105
|
+
- lib/acts_as_unvlogable/vg_qik.rb
|
106
|
+
- lib/acts_as_unvlogable/vg_rutube.rb
|
107
|
+
- lib/acts_as_unvlogable/vg_ted.rb
|
108
|
+
- lib/acts_as_unvlogable/vg_vimeo.rb
|
109
|
+
- lib/acts_as_unvlogable/vg_youtu.rb
|
110
|
+
- lib/acts_as_unvlogable/vg_youtube.rb
|
111
|
+
- test/acts_as_unvlogable_test.rb
|
112
|
+
- test/video_factory_test.rb
|
113
|
+
- unvlogable_sample.yml
|
114
|
+
homepage: https://github.com/mamuso/acts_as_unvlogable
|
115
|
+
licenses: []
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project: acts_as_unvlogable
|
133
|
+
rubygems_version: 2.4.1
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: An easy way to include external video services in a rails app
|
137
|
+
test_files: []
|