video_info 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/lib/video_info/providers/vimeo.rb +1 -1
  4. data/lib/video_info/version.rb +1 -1
  5. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_This_video_does_not_exist_or_has_been_deleted_/{available_ → _available_}/.yml +12 -19
  6. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_valid_video/{available_ → _available_}/.yml +10 -15
  7. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{view_count → _date}/.yml +12 -17
  8. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{keywords → _description}/.yml +12 -17
  9. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{date → _duration}/.yml +12 -17
  10. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/{thumbnail_large → _keywords}/.yml +12 -17
  11. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_large/.yml +58 -0
  12. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_medium/.yml +58 -0
  13. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_thumbnail_small/.yml +58 -0
  14. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_title/.yml +58 -0
  15. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/_view_count/.yml +58 -0
  16. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_VimeoPlaylist/_available_/with_valid_playlist/available_ → VideoInfo_Providers_Vimeo/_available_/with_password_required_video/_available_}/.yml +28 -36
  17. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_this_video_does_not_exist_video/{available_ → _available_}/.yml +11 -11
  18. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/_available_/with_valid_video/{available_ → _available_}/.yml +13 -13
  19. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_date/.yml +73 -0
  20. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_description/.yml +73 -0
  21. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_duration/.yml +73 -0
  22. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_height/.yml +73 -0
  23. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_keywords/.yml +73 -0
  24. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_large/.yml +73 -0
  25. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_medium/.yml +73 -0
  26. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_thumbnail_small/.yml +73 -0
  27. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_title/.yml +73 -0
  28. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_view_count/.yml +73 -0
  29. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/_width/.yml +73 -0
  30. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_Vimeo/_available_/with_password_required_video/available_ → VideoInfo_Providers_VimeoPlaylist/_available_/with_invalid_playlist/_available_}/.yml +12 -12
  31. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/_available_/with_valid_playlist/_available_/.yml +54 -0
  32. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_description/.yml +71 -0
  33. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_thumbnail_large/.yml +71 -0
  34. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_thumbnail_medium/.yml +71 -0
  35. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_thumbnail_small/.yml +71 -0
  36. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_title/.yml +71 -0
  37. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_1921098/_videos/.yml +104 -0
  38. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/_available_/.yml +46 -0
  39. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/_available_/.yml +1137 -0
  40. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/_title/.yml +1363 -0
  41. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_description/.yml +1137 -0
  42. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_duration/.yml +1137 -0
  43. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_embed_code/.yml +1137 -0
  44. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_embed_url/.yml +1137 -0
  45. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_height/.yml +1137 -0
  46. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_keywords/.yml +1137 -0
  47. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_title/.yml +1137 -0
  48. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_view_count/.yml +1137 -0
  49. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/_width/.yml +1137 -0
  50. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_valid_video/{available_ → _available_}/.yml +9 -9
  51. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_is_unavailable_video/{available_ → _available_}/.yml +6 -6
  52. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/_available_/with_video_no_longer_available_due_to_a_copyright_claim_video/{available_ → _available_}/.yml +6 -6
  53. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_date/.yml +61 -0
  54. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_description/.yml +61 -0
  55. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_duration/.yml +61 -0
  56. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_keywords/.yml +61 -0
  57. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_thumbnail_large/.yml +61 -0
  58. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_thumbnail_medium/.yml +61 -0
  59. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_thumbnail_small/.yml +61 -0
  60. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_title/.yml +61 -0
  61. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/_view_count/.yml +61 -0
  62. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_invalid_playlist/{available_ → _available_}/.yml +6 -6
  63. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/_available_/with_valid_playlist/{available_ → _available_}/.yml +9 -9
  64. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL0E8117603D70E10A_in_embed_path/_videos/.yml +61 -0
  65. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/title → VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_description}/.yml +27 -95
  66. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/thumbnail_medium → VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_large}/.yml +31 -97
  67. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/thumbnail_small → VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_medium}/.yml +31 -101
  68. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_thumbnail_small/.yml +98 -0
  69. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_title/.yml +98 -0
  70. data/spec/fixtures/vcr_cassettes/{VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/description → VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/_videos}/.yml +27 -95
  71. data/spec/lib/video_info/providers/dailymotion_spec.rb +101 -23
  72. data/spec/lib/video_info/providers/vimeo_playlist_spec.rb +110 -32
  73. data/spec/lib/video_info/providers/vimeo_spec.rb +134 -29
  74. data/spec/lib/video_info/providers/vkontakte_spec.rb +95 -21
  75. data/spec/lib/video_info/providers/youtube_playlist_spec.rb +110 -25
  76. data/spec/lib/video_info/providers/youtube_spec.rb +206 -47
  77. data/spec/lib/video_info_spec.rb +20 -20
  78. data/spec/spec_helper.rb +1 -5
  79. data/video_info.gemspec +1 -0
  80. metadata +148 -178
  81. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_video_is_unavailable_video/available_/.yml +0 -46
  82. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/_available_/with_video_no_longer_available_due_to_a_copyright_claim_video/available_/.yml +0 -46
  83. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/description/.yml +0 -63
  84. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/duration/.yml +0 -63
  85. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/thumbnail_medium/.yml +0 -63
  86. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/thumbnail_small/.yml +0 -63
  87. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Dailymotion/with_video_x7lni3/title/.yml +0 -63
  88. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/date/.yml +0 -76
  89. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/description/.yml +0 -76
  90. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/duration/.yml +0 -76
  91. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/height/.yml +0 -76
  92. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/keywords/.yml +0 -76
  93. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/thumbnail_large/.yml +0 -76
  94. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/thumbnail_medium/.yml +0 -76
  95. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/thumbnail_small/.yml +0 -76
  96. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/title/.yml +0 -76
  97. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/view_count/.yml +0 -76
  98. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vimeo/with_video_898029/width/.yml +0 -76
  99. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/_available_/with_invalid_playlist/available_/.yml +0 -152
  100. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/date/.yml +0 -75
  101. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/duration/.yml +0 -75
  102. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/height/.yml +0 -71
  103. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/keywords/.yml +0 -75
  104. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/thumbnail_large/.yml +0 -168
  105. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/videos/.yml +0 -202
  106. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/view_count/.yml +0 -71
  107. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_VimeoPlaylist/with_playlist_2755718/width/.yml +0 -71
  108. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_invalid_video/available_/.yml +0 -147
  109. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/_available_/with_valid_video/available_/.yml +0 -1115
  110. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/description/.yml +0 -1139
  111. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/duration/.yml +0 -1139
  112. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/embed_code/.yml +0 -1139
  113. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/embed_url/.yml +0 -1139
  114. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/height/.yml +0 -1139
  115. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/keywords/.yml +0 -1139
  116. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/title/.yml +0 -1139
  117. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/view_count/.yml +0 -1139
  118. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_39576223_108370515/width/.yml +0 -1139
  119. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video-54799401_165822734/title/.yml +0 -1331
  120. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/description/.yml +0 -1125
  121. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/duration/.yml +0 -1125
  122. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_code/.yml +0 -1125
  123. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/embed_url/.yml +0 -1125
  124. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/height/.yml +0 -1125
  125. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/keywords/.yml +0 -1125
  126. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/title/.yml +0 -1084
  127. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/view_count/.yml +0 -1125
  128. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Vkontakte/with_video_video39576223_108370515/width/.yml +0 -1125
  129. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/date/.yml +0 -61
  130. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/description/.yml +0 -61
  131. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/duration/.yml +0 -61
  132. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/keywords/.yml +0 -63
  133. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/thumbnail_large/.yml +0 -61
  134. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/thumbnail_medium/.yml +0 -61
  135. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/thumbnail_small/.yml +0 -61
  136. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/title/.yml +0 -63
  137. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_Youtube/with_video_mZqGqE0D0n4/view_count/.yml +0 -61
  138. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL0E8117603D70E10A_in_embed_path/videos/.yml +0 -61
  139. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/.yml +0 -98
  140. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/date/.yml +0 -98
  141. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/description/.yml +0 -98
  142. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/duration/.yml +0 -98
  143. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/keywords/.yml +0 -98
  144. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/thumbnail_large/.yml +0 -96
  145. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/thumbnail_medium/.yml +0 -96
  146. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/thumbnail_small/.yml +0 -98
  147. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/title/.yml +0 -98
  148. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/videos/.yml +0 -96
  149. data/spec/fixtures/vcr_cassettes/VideoInfo_Providers_YoutubePlaylist/with_playlist_PL9hW1uS6HUftLdHI6RIsaf/view_count/.yml +0 -98
@@ -7,61 +7,136 @@ describe VideoInfo::Providers::Youtube do
7
7
 
8
8
  context "with youtube.com url" do
9
9
  let(:url) { 'http://www.youtube.com/watch?v=Xp6CXF' }
10
- it { should be_true }
10
+ it { is_expected.to be_truthy }
11
11
  end
12
12
 
13
13
  context "with youtu.be url" do
14
14
  let(:url) { 'http://youtu.be/JM9NgvjjVng' }
15
- it { should be_true }
15
+ it { is_expected.to be_truthy }
16
16
  end
17
17
 
18
18
  context "with other url" do
19
19
  let(:url) { 'http://google.com/video1' }
20
- it { should be_false }
20
+ it { is_expected.to be_falsey }
21
21
  end
22
22
 
23
23
  context "with playlist url" do
24
24
  let(:url) { 'http://www.youtube.com/playlist?p=PLA575C81A1FBC04CF' }
25
- it { should be_false }
25
+ it { is_expected.to be_falsey }
26
26
  end
27
27
  end
28
28
 
29
29
  describe "#available?" do
30
30
  context "with valid video", :vcr do
31
31
  subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
32
- its(:available?) { should be_true }
32
+
33
+ describe '#available?' do
34
+ subject { super().available? }
35
+ it { is_expected.to be_truthy }
36
+ end
33
37
  end
34
38
 
35
39
  context "with 'video is unavailable' video", :vcr do
36
40
  subject { VideoInfo.new('http://www.youtube.com/watch?v=SUkXvWn1m7Q') }
37
- its(:available?) { should be_false }
41
+
42
+ describe '#available?' do
43
+ subject { super().available? }
44
+ it { is_expected.to be_falsey }
45
+ end
38
46
  end
39
47
 
40
48
  context "with 'video no longer available due to a copyright claim' video", :vcr do
41
49
  subject { VideoInfo.new('http://www.youtube.com/watch?v=ffClNhwx0KU') }
42
- its(:available?) { should be_false }
50
+
51
+ describe '#available?' do
52
+ subject { super().available? }
53
+ it { is_expected.to be_falsey }
54
+ end
43
55
  end
44
56
  end
45
57
 
46
58
  context "with video mZqGqE0D0n4", :vcr do
47
59
  subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
48
60
 
49
- its(:provider) { should eq 'YouTube' }
50
- its(:video_id) { should eq 'mZqGqE0D0n4' }
51
- its(:url) { should eq 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
52
- its(:embed_url) { should eq '//www.youtube.com/embed/mZqGqE0D0n4' }
53
- its(:embed_code) { should eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
54
- its(:title) { should eq 'Cherry Bloom - King Of The Knife' }
55
- its(:description) { should eq 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
56
- its(:keywords) { should be_nil }
57
- its(:duration) { should eq 176 }
58
- its(:width) { should be_nil }
59
- its(:height) { should be_nil }
60
- its(:date) { should eq Time.parse('Sat Apr 12 22:25:35 UTC 2008', Time.now.utc) }
61
- its(:thumbnail_small) { should eq 'http://i1.ytimg.com/vi/mZqGqE0D0n4/default.jpg' }
62
- its(:thumbnail_medium) { should eq 'http://i1.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg' }
63
- its(:thumbnail_large) { should eq 'http://i1.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg' }
64
- its(:view_count) { should be > 4000 }
61
+ describe '#provider' do
62
+ subject { super().provider }
63
+ it { is_expected.to eq 'YouTube' }
64
+ end
65
+
66
+ describe '#video_id' do
67
+ subject { super().video_id }
68
+ it { is_expected.to eq 'mZqGqE0D0n4' }
69
+ end
70
+
71
+ describe '#url' do
72
+ subject { super().url }
73
+ it { is_expected.to eq 'http://www.youtube.com/watch?v=mZqGqE0D0n4' }
74
+ end
75
+
76
+ describe '#embed_url' do
77
+ subject { super().embed_url }
78
+ it { is_expected.to eq '//www.youtube.com/embed/mZqGqE0D0n4' }
79
+ end
80
+
81
+ describe '#embed_code' do
82
+ subject { super().embed_code }
83
+ it { is_expected.to eq '<iframe src="//www.youtube.com/embed/mZqGqE0D0n4" frameborder="0" allowfullscreen="allowfullscreen"></iframe>' }
84
+ end
85
+
86
+ describe '#title' do
87
+ subject { super().title }
88
+ it { is_expected.to eq 'Cherry Bloom - King Of The Knife' }
89
+ end
90
+
91
+ describe '#description' do
92
+ subject { super().description }
93
+ it { is_expected.to eq 'The first video from the upcoming album Secret Sounds, to download in-stores April 14. Checkout http://www.cherrybloom.net' }
94
+ end
95
+
96
+ describe '#keywords' do
97
+ subject { super().keywords }
98
+ it { is_expected.to be_nil }
99
+ end
100
+
101
+ describe '#duration' do
102
+ subject { super().duration }
103
+ it { is_expected.to eq 176 }
104
+ end
105
+
106
+ describe '#width' do
107
+ subject { super().width }
108
+ it { is_expected.to be_nil }
109
+ end
110
+
111
+ describe '#height' do
112
+ subject { super().height }
113
+ it { is_expected.to be_nil }
114
+ end
115
+
116
+ describe '#date' do
117
+ subject { super().date }
118
+ it { is_expected.to eq Time.parse('Sat Apr 12 22:25:35 UTC 2008', Time.now.utc) }
119
+ end
120
+
121
+ describe '#thumbnail_small' do
122
+ subject { super().thumbnail_small }
123
+ it { is_expected.to eq 'http://i.ytimg.com/vi/mZqGqE0D0n4/default.jpg' }
124
+ end
125
+
126
+ describe '#thumbnail_medium' do
127
+ subject { super().thumbnail_medium }
128
+ it { is_expected.to eq 'http://i.ytimg.com/vi/mZqGqE0D0n4/mqdefault.jpg' }
129
+ end
130
+
131
+ describe '#thumbnail_large' do
132
+ subject { super().thumbnail_large }
133
+ it { is_expected.to eq 'http://i.ytimg.com/vi/mZqGqE0D0n4/hqdefault.jpg' }
134
+ end
135
+
136
+ describe '#view_count' do
137
+ subject { super().view_count }
138
+ it { is_expected.to be > 4000 }
139
+ end
65
140
  end
66
141
 
67
142
  context "with video oQ49W_xKzKA", :vcr do
@@ -73,79 +148,160 @@ describe VideoInfo::Providers::Youtube do
73
148
  context "with video oQ49W_xKzKA", :vcr do
74
149
  subject { VideoInfo.new('http://www.youtube.com/watch?v=oQ49W_xKzKA') }
75
150
 
76
- its(:provider) { should eq 'YouTube' }
77
- its(:video_id) { should eq 'oQ49W_xKzKA' }
151
+ describe '#provider' do
152
+ subject { super().provider }
153
+ it { is_expected.to eq 'YouTube' }
154
+ end
155
+
156
+ describe '#video_id' do
157
+ subject { super().video_id }
158
+ it { is_expected.to eq 'oQ49W_xKzKA' }
159
+ end
78
160
  end
79
161
 
80
162
  context "with video Xp6CXF-Cesg", :vcr do
81
163
  subject { VideoInfo.new('http://www.youtube.com/watch?v=Xp6CXF-Cesg') }
82
164
 
83
- its(:provider) { should eq 'YouTube' }
84
- its(:video_id) { should eq 'Xp6CXF-Cesg' }
165
+ describe '#provider' do
166
+ subject { super().provider }
167
+ it { is_expected.to eq 'YouTube' }
168
+ end
169
+
170
+ describe '#video_id' do
171
+ subject { super().video_id }
172
+ it { is_expected.to eq 'Xp6CXF-Cesg' }
173
+ end
85
174
  end
86
175
 
87
176
  context "with video VeasFckfMHY in user url", :vcr do
88
177
  subject { VideoInfo.new('http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY') }
89
178
 
90
- its(:provider) { should eq 'YouTube' }
91
- its(:video_id) { should eq 'VeasFckfMHY' }
92
- its(:url) { should eq 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY' }
179
+ describe '#provider' do
180
+ subject { super().provider }
181
+ it { is_expected.to eq 'YouTube' }
182
+ end
183
+
184
+ describe '#video_id' do
185
+ subject { super().video_id }
186
+ it { is_expected.to eq 'VeasFckfMHY' }
187
+ end
188
+
189
+ describe '#url' do
190
+ subject { super().url }
191
+ it { is_expected.to eq 'http://www.youtube.com/user/EducatorVids3?v=VeasFckfMHY' }
192
+ end
93
193
  end
94
194
 
95
195
  context "with video VeasFckfMHY after params", :vcr do
96
196
  subject { VideoInfo.new('http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY') }
97
197
 
98
- its(:provider) { should eq 'YouTube' }
99
- its(:video_id) { should eq 'VeasFckfMHY' }
100
- its(:url) { should eq 'http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY' }
198
+ describe '#provider' do
199
+ subject { super().provider }
200
+ it { is_expected.to eq 'YouTube' }
201
+ end
202
+
203
+ describe '#video_id' do
204
+ subject { super().video_id }
205
+ it { is_expected.to eq 'VeasFckfMHY' }
206
+ end
207
+
208
+ describe '#url' do
209
+ subject { super().url }
210
+ it { is_expected.to eq 'http://www.youtube.com/watch?feature=player_profilepage&v=VeasFckfMHY' }
211
+ end
101
212
  end
102
213
 
103
214
  context "with video VeasFckfMHY in path", :vcr do
104
215
  subject { VideoInfo.new('http://www.youtube.com/v/VeasFckfMHY') }
105
216
 
106
- its(:provider) { should eq 'YouTube' }
107
- its(:video_id) { should eq 'VeasFckfMHY' }
217
+ describe '#provider' do
218
+ subject { super().provider }
219
+ it { is_expected.to eq 'YouTube' }
220
+ end
221
+
222
+ describe '#video_id' do
223
+ subject { super().video_id }
224
+ it { is_expected.to eq 'VeasFckfMHY' }
225
+ end
108
226
  end
109
227
 
110
228
  context "with video VeasFckfMHY in e path", :vcr do
111
229
  subject { VideoInfo.new('http://www.youtube.com/e/VeasFckfMHY') }
112
230
 
113
- its(:provider) { should eq 'YouTube' }
114
- its(:video_id) { should eq 'VeasFckfMHY' }
231
+ describe '#provider' do
232
+ subject { super().provider }
233
+ it { is_expected.to eq 'YouTube' }
234
+ end
235
+
236
+ describe '#video_id' do
237
+ subject { super().video_id }
238
+ it { is_expected.to eq 'VeasFckfMHY' }
239
+ end
115
240
  end
116
241
 
117
242
  context "with video VeasFckfMHY in embed path", :vcr do
118
243
  subject { VideoInfo.new('http://www.youtube.com/embed/VeasFckfMHY') }
119
244
 
120
- its(:provider) { should eq 'YouTube' }
121
- its(:video_id) { should eq 'VeasFckfMHY' }
245
+ describe '#provider' do
246
+ subject { super().provider }
247
+ it { is_expected.to eq 'YouTube' }
248
+ end
249
+
250
+ describe '#video_id' do
251
+ subject { super().video_id }
252
+ it { is_expected.to eq 'VeasFckfMHY' }
253
+ end
122
254
  end
123
255
 
124
256
  context "with video JM9NgvjjVng in youtu.be url", :vcr do
125
257
  subject { VideoInfo.new('http://youtu.be/JM9NgvjjVng') }
126
258
 
127
- its(:provider) { should eq 'YouTube' }
128
- its(:video_id) { should eq 'JM9NgvjjVng' }
259
+ describe '#provider' do
260
+ subject { super().provider }
261
+ it { is_expected.to eq 'YouTube' }
262
+ end
263
+
264
+ describe '#video_id' do
265
+ subject { super().video_id }
266
+ it { is_expected.to eq 'JM9NgvjjVng' }
267
+ end
129
268
  end
130
269
 
131
270
  context 'without http or www', :vcr do
132
271
  subject { VideoInfo.new('youtu.be/JM9NgvjjVng') }
133
272
 
134
- its(:provider) { should == 'YouTube' }
135
- its(:video_id) { should eq 'JM9NgvjjVng' }
273
+ describe '#provider' do
274
+ subject { super().provider }
275
+ it { is_expected.to eq('YouTube') }
276
+ end
277
+
278
+ describe '#video_id' do
279
+ subject { super().video_id }
280
+ it { is_expected.to eq 'JM9NgvjjVng' }
281
+ end
136
282
  end
137
283
 
138
284
  context "with video url in text", :vcr do
139
285
  subject { VideoInfo.new('<a href="http://www.youtube.com/watch?v=mZqGqE0D0n4">http://www.youtube.com/watch?v=mZqGqE0D0n4</a>') }
140
286
 
141
- its(:provider) { should == 'YouTube' }
142
- its(:video_id) { should == 'mZqGqE0D0n4' }
287
+ describe '#provider' do
288
+ subject { super().provider }
289
+ it { is_expected.to eq('YouTube') }
290
+ end
291
+
292
+ describe '#video_id' do
293
+ subject { super().video_id }
294
+ it { is_expected.to eq('mZqGqE0D0n4') }
295
+ end
143
296
  end
144
297
 
145
298
  context "with iframe attributes", :vcr do
146
299
  subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
147
300
 
148
- its(:provider) { should == 'YouTube' }
301
+ describe '#provider' do
302
+ subject { super().provider }
303
+ it { is_expected.to eq('YouTube') }
304
+ end
149
305
  it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/width="800"/) }
150
306
  it { expect(subject.embed_code(iframe_attributes: { width: 800, height: 600 })).to match(/height="600"/) }
151
307
  end
@@ -153,7 +309,10 @@ describe VideoInfo::Providers::Youtube do
153
309
  context "with arbitrary iframe_attributes", :vcr do
154
310
  subject { VideoInfo.new('http://www.youtube.com/watch?v=mZqGqE0D0n4') }
155
311
 
156
- its(:provider) { should == 'YouTube' }
312
+ describe '#provider' do
313
+ subject { super().provider }
314
+ it { is_expected.to eq('YouTube') }
315
+ end
157
316
  it { expect(subject.embed_code(iframe_attributes: { :'data-colorbox' => true })).to match(/data-colorbox="true"/) }
158
317
  end
159
318
 
@@ -8,18 +8,18 @@ describe VideoInfo do
8
8
  let(:provider) { double('provider', provider: 'Provider') }
9
9
 
10
10
  it "uses the first usable provider" do
11
- VideoInfo::Providers::Vimeo.stub(:usable?) { false }
12
- VideoInfo::Providers::Vkontakte.stub(:usable?) { false }
13
- VideoInfo::Providers::Youtube.stub(:usable?) { true }
14
- VideoInfo::Providers::Youtube.stub(:new) { provider }
11
+ allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
12
+ allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
13
+ allow(VideoInfo::Providers::Youtube).to receive(:usable?) { true }
14
+ allow(VideoInfo::Providers::Youtube).to receive(:new) { provider }
15
15
 
16
16
  expect(VideoInfo.new(url, options).provider).to eq 'Provider'
17
17
  end
18
18
 
19
19
  it "raise when no providers are usable" do
20
- VideoInfo::Providers::Vimeo.stub(:usable?) { false }
21
- VideoInfo::Providers::Vkontakte.stub(:usable?) { false }
22
- VideoInfo::Providers::Youtube.stub(:usable?) { false }
20
+ allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
21
+ allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
22
+ allow(VideoInfo::Providers::Youtube).to receive(:usable?) { false }
23
23
 
24
24
  expect { VideoInfo.new(url, options) }.to raise_error(VideoInfo::UrlError)
25
25
  end
@@ -30,20 +30,20 @@ describe VideoInfo do
30
30
  let(:provider) { double('provider', new: true) }
31
31
 
32
32
  it "returns true when a provider is usable" do
33
- VideoInfo::Providers::Vimeo.stub(:usable?) { false }
34
- VideoInfo::Providers::Vkontakte.stub(:usable?) { false }
35
- VideoInfo::Providers::Youtube.stub(:usable?) { true }
36
- VideoInfo::Providers::Youtube.stub(:new) { true }
33
+ allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
34
+ allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
35
+ allow(VideoInfo::Providers::Youtube).to receive(:usable?) { true }
36
+ allow(VideoInfo::Providers::Youtube).to receive(:new) { true }
37
37
 
38
- expect(VideoInfo.usable?(url)).to be_true
38
+ expect(VideoInfo.usable?(url)).to be_truthy
39
39
  end
40
40
 
41
41
  it "returns false when no providers are usable" do
42
- VideoInfo::Providers::Vimeo.stub(:usable?) { false }
43
- VideoInfo::Providers::Vkontakte.stub(:usable?) { false }
44
- VideoInfo::Providers::Youtube.stub(:usable?) { false }
42
+ allow(VideoInfo::Providers::Vimeo).to receive(:usable?) { false }
43
+ allow(VideoInfo::Providers::Vkontakte).to receive(:usable?) { false }
44
+ allow(VideoInfo::Providers::Youtube).to receive(:usable?) { false }
45
45
 
46
- expect(VideoInfo.usable?(url)).to be_false
46
+ expect(VideoInfo.usable?(url)).to be_falsey
47
47
  end
48
48
  end
49
49
 
@@ -54,15 +54,15 @@ describe VideoInfo do
54
54
 
55
55
  context "matching" do
56
56
  it "returns true" do
57
- expect(vi_a == vi_a).to be_true
58
- expect(vi_a == vi_b).to be_true
57
+ expect(vi_a == vi_a).to be_truthy
58
+ expect(vi_a == vi_b).to be_truthy
59
59
  end
60
60
  end
61
61
 
62
62
  context "not matching" do
63
63
  it "returns false" do
64
- expect(vi_a == vi_c).to be_false
65
- expect(vi_b == vi_c).to be_false
64
+ expect(vi_a == vi_c).to be_falsey
65
+ expect(vi_b == vi_c).to be_falsey
66
66
  end
67
67
  end
68
68
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec'
2
+ require 'rspec/its'
2
3
  require 'video_info'
3
4
  require 'vcr'
4
5
 
@@ -18,11 +19,6 @@ VCR.configure do |config|
18
19
  end
19
20
 
20
21
  RSpec.configure do |config|
21
- config.color_enabled = true
22
22
  config.filter_run focus: true
23
23
  config.run_all_when_everything_filtered = true
24
- config.treat_symbols_as_metadata_keys_with_true_values = true
25
- config.expect_with :rspec do |c|
26
- c.syntax = :expect
27
- end
28
24
  end
data/video_info.gemspec CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency 'bundler', '>= 1.3.5'
28
28
  s.add_development_dependency 'rake'
29
29
  s.add_development_dependency 'rspec'
30
+ s.add_development_dependency 'rspec-its'
30
31
  s.add_development_dependency 'vcr'
31
32
  s.add_development_dependency 'webmock'
32
33
  end