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.
@@ -1,66 +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 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