film_snob 0.3.13 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +61 -0
  5. data/.travis.yml +9 -1
  6. data/Gemfile +2 -1
  7. data/README.md +15 -3
  8. data/Rakefile +2 -2
  9. data/film_snob.gemspec +9 -6
  10. data/lib/film_snob/coub.rb +2 -3
  11. data/lib/film_snob/dailymotion.rb +3 -4
  12. data/lib/film_snob/deprecated.rb +13 -0
  13. data/lib/film_snob/exceptions.rb +1 -0
  14. data/lib/film_snob/funny_or_die.rb +1 -0
  15. data/lib/film_snob/hulu.rb +2 -3
  16. data/lib/film_snob/instagram.rb +13 -4
  17. data/lib/film_snob/url_to_video.rb +7 -8
  18. data/lib/film_snob/version.rb +2 -1
  19. data/lib/film_snob/video_site.rb +34 -35
  20. data/lib/film_snob/vimeo.rb +2 -3
  21. data/lib/film_snob/youtube.rb +6 -4
  22. data/lib/film_snob.rb +16 -12
  23. data/spec/cassettes/coub/.keep +0 -0
  24. data/spec/cassettes/dailymotion/.keep +0 -0
  25. data/spec/cassettes/funnyordie/.keep +0 -0
  26. data/spec/cassettes/hulu/.keep +0 -0
  27. data/spec/cassettes/instagram/.keep +0 -0
  28. data/spec/cassettes/vimeo/.keep +0 -0
  29. data/spec/cassettes/youtube/.keep +0 -0
  30. data/spec/deprecated_spec.rb +32 -0
  31. data/spec/film_snob_spec.rb +124 -111
  32. data/spec/spec_helper.rb +9 -4
  33. data/spec/youtube_spec.rb +24 -19
  34. metadata +50 -35
  35. data/spec/cassettes/coub/voodoo_people.yml +0 -53
  36. data/spec/cassettes/dailymotion/music.yml +0 -57
  37. data/spec/cassettes/dailymotion/music1.yml +0 -57
  38. data/spec/cassettes/dailymotion/music500.yml +0 -57
  39. data/spec/cassettes/funnyordie/space_jam.yml +0 -66
  40. data/spec/cassettes/hulu/harmon.yml +0 -47
  41. data/spec/cassettes/instagram/nothing.yml +0 -52
  42. data/spec/cassettes/instagram/sphynx_cat.yml +0 -53
  43. data/spec/cassettes/vimeo/murmuration.yml +0 -66
  44. data/spec/cassettes/vimeo/murmuration2.yml +0 -66
  45. data/spec/cassettes/vimeo/stephen.yml +0 -67
  46. data/spec/cassettes/youtube/bad_youtube_url.yml +0 -49
  47. data/spec/cassettes/youtube/billy.yml +0 -55
  48. data/spec/cassettes/youtube/dilla.yml +0 -54
  49. data/spec/cassettes/youtube/missing_video.yml +0 -49
  50. data/spec/cassettes/youtube/pete.yml +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e540dd00b0161a2fe79ce95e2abb04cb17370ee
4
- data.tar.gz: ca75a3474f8708646a051f3f5de1bbbf8f129f95
3
+ metadata.gz: 1acb76c2c15e8ea0c82ec3aab3132d2b0e5b0f7c
4
+ data.tar.gz: 2a55b8d551947ceab6109a286110843d9cf6a6d9
5
5
  SHA512:
6
- metadata.gz: 8944edd5a9572e080c14178f968fd584ec9a1c8c1f57e15cb4b93c86d4b1dcd306209f12d74dc30c26e0538f1499387d4da79415eed8d757bc1ab4a1829758bb
7
- data.tar.gz: b7790ee53b97c0e9f86b1c009a80482b4ca8e4f5c8f12b623d729c76c4440501ce238d0d6df55d487c816dbd619596d4900ba32ec7871ad65c50f4a713f8220c
6
+ metadata.gz: 8f2ec020294584d776de1787c3ddf01d968757a7ad335cb1599005fb68d59c2f7ee62091421cf13fa7c8cb7a76ab4478618252de353fb53afd2c448f6c3a8996
7
+ data.tar.gz: 863ced2514af6a67874e11de5e896dc49c17a08404c94c18bf600c96caacc5c0851eed56ea73960ba4a6a157171717adde78bd33085f5056c0b4f6a79fc6a262
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ spec/cassettes/**/*.yml
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,61 @@
1
+ Style/CollectionMethods:
2
+ # Mapping from undesired method to desired_method
3
+ # e.g. to use `detect` over `find`:
4
+ #
5
+ # CollectionMethods:
6
+ # PreferredMethods:
7
+ # find: detect
8
+ PreferredMethods:
9
+ collect: 'map'
10
+ collect!: 'map!'
11
+ reduce: 'inject'
12
+ detect: 'find'
13
+ select: 'find_all'
14
+
15
+ # Disabling this because I don't love using the return keyword
16
+ # and sometimes lines get long and difficult to read that way
17
+ Style/GuardClause:
18
+ Description: "Check for conditionals that can be replaced with guard clauses"
19
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals"
20
+ Enabled: false
21
+
22
+ # I don't want to write documentation for every class
23
+ Style/Documentation:
24
+ Description: "Document classes and non-namespace modules."
25
+ Enabled: false
26
+
27
+ # I will use the %r syntax even if there's only one slash
28
+ Style/RegexpLiteral:
29
+ Description: >-
30
+ Use %r for regular expressions matching more than
31
+ `MaxSlashes` "/" characters.
32
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#percent-r"
33
+ MaxSlashes: 0
34
+ Enabled: true
35
+
36
+ # I prefer raise to fail, so I'm disabling this one
37
+ Style/SignalException:
38
+ Description: "Checks for proper usage of fail and raise."
39
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#fail-method"
40
+ Enabled: false
41
+
42
+ # I prefer double quotes
43
+ Style/StringLiterals:
44
+ Description: "Checks if uses of quotes match the configured preference."
45
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-string-literals"
46
+ Enabled: true
47
+ EnforcedStyle: double_quotes
48
+
49
+ # Expect a final blank line
50
+ Style/TrailingBlankLines:
51
+ Description: "Checks trailing blank lines and final newline."
52
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#newline-eof"
53
+ Enabled: true
54
+ EnforcedStyle: final_blank_line
55
+
56
+ # I like to use assignment in conditions
57
+ Lint/AssignmentInCondition:
58
+ Description: "Don't use assignment in conditions."
59
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition"
60
+ Enabled: false
61
+
data/.travis.yml CHANGED
@@ -4,4 +4,12 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.0
6
6
  - 2.1.1
7
- before_install: 'gem install bundler -v 1.6'
7
+ - 2.1.2
8
+ - 2.1.3
9
+ - 2.1.4
10
+ - 2.1.5
11
+ before_install: "gem install bundler -v 1.6"
12
+ script:
13
+ - bundle exec rake
14
+ - bundle exec rubocop
15
+
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in film_snob.gemspec
4
4
  gemspec
5
+
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/maxjacobson/film_snob.svg?branch=master)](https://travis-ci.org/maxjacobson/film_snob)
4
4
  [![Gem Version](https://badge.fury.io/rb/film_snob.svg)](http://badge.fury.io/rb/film_snob)
5
5
  [![Code Climate](https://codeclimate.com/github/maxjacobson/film_snob.png)](https://codeclimate.com/github/maxjacobson/film_snob)
6
+ [![Test Coverage](https://codeclimate.com/github/maxjacobson/film_snob/badges/coverage.svg)](https://codeclimate.com/github/maxjacobson/film_snob)
6
7
 
7
8
  Helps parse URLs of web videos.
8
9
 
@@ -10,7 +11,7 @@ Helps parse URLs of web videos.
10
11
 
11
12
  Add this line to your application's Gemfile:
12
13
 
13
- gem 'film_snob'
14
+ gem "film_snob"
14
15
 
15
16
  And then execute:
16
17
 
@@ -24,7 +25,7 @@ Or install it yourself as:
24
25
 
25
26
  ```ruby
26
27
  film = FilmSnob.new("https://www.youtube.com/watch?v=GwT3zH16w3s")
27
- film.watchable? #=> true
28
+ film.embeddable? #=> true
28
29
  film.site #=> :youtube
29
30
  film.id #=> "GwT3zH16w3s"
30
31
  film.title #=> "What Are You, The Coolest? With Robert Rodriguez"
@@ -57,10 +58,21 @@ The same methods work with all of these providers.
57
58
 
58
59
  Run `rake` to run all of the rspecs.
59
60
 
61
+ ## Code Style
62
+
63
+ Run `rubocop` and try to keep the cops happy.
64
+
65
+ ## Questions?
66
+
67
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/maxjacobson/film_snob?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
68
+
69
+ Ping me in [the Gitter chat room](https://gitter.im/maxjacobson/film_snob) or [create a GitHub issue](https://github.com/maxjacobson/film_snob/issues/new)
70
+
60
71
  ## Contributing
61
72
 
62
73
  1. Fork it ( https://github.com/maxjacobson/film_snob/fork )
63
74
  2. Create your feature branch (`git checkout -b my-new-feature`)
64
- 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 3. Commit your changes (`git commit -am "Add some feature"`)
65
76
  4. Push to the branch (`git push origin my-new-feature`)
66
77
  5. Create a new Pull Request
78
+
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
2
+ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
7
7
 
data/film_snob.gemspec CHANGED
@@ -1,15 +1,16 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'film_snob/version'
4
+ require "film_snob/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "film_snob"
8
8
  spec.version = FilmSnob::VERSION
9
9
  spec.authors = ["Max Jacobson"]
10
10
  spec.email = ["max@hardscrabble.net"]
11
- spec.summary = %q{Fetch embed codes for videos}
12
- spec.description = %q{Find information about URLs from video sites, such as the title and embed code of the video}
11
+ spec.summary = "Fetch embed codes for videos"
12
+ spec.description = "Find information about URLs from video sites, " \
13
+ "such as the title and embed code of the video"
13
14
  spec.homepage = "https://github.com/maxjacobson/film_snob"
14
15
  spec.license = "MIT"
15
16
 
@@ -24,6 +25,8 @@ Gem::Specification.new do |spec|
24
25
  spec.add_development_dependency "webmock", "~> 1.17"
25
26
  spec.add_development_dependency "vcr", "~> 2.9"
26
27
  spec.add_development_dependency "pry", "~> 0.9"
27
-
28
- spec.required_ruby_version = '>= 1.9.3'
28
+ spec.add_development_dependency "rubocop", "~> 0.26.1"
29
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4"
30
+ spec.required_ruby_version = ">= 1.9.3"
29
31
  end
32
+
@@ -2,7 +2,6 @@ require "film_snob/video_site"
2
2
 
3
3
  class FilmSnob
4
4
  class Coub < VideoSite
5
-
6
5
  def self.valid_url_patterns
7
6
  [
8
7
  %r{https?://coub.com/view/(\w*)}
@@ -14,8 +13,8 @@ class FilmSnob
14
13
  end
15
14
 
16
15
  def self.oembed_endpoint
17
- 'http://coub.com/api/oembed.json'
16
+ "http://coub.com/api/oembed.json"
18
17
  end
19
-
20
18
  end
21
19
  end
20
+
@@ -2,11 +2,10 @@ require "film_snob/video_site"
2
2
 
3
3
  class FilmSnob
4
4
  class Dailymotion < VideoSite
5
-
6
5
  def self.valid_url_patterns
7
6
  [
8
7
  %r{https?://www.dailymotion.com/video/([\w\d\-_]+)},
9
- %r{https?://touch.dailymotion.com/video/([\w\d\-_]+)},
8
+ %r{https?://touch.dailymotion.com/video/([\w\d\-_]+)}
10
9
  ]
11
10
  end
12
11
 
@@ -15,8 +14,8 @@ class FilmSnob
15
14
  end
16
15
 
17
16
  def self.oembed_endpoint
18
- 'http://www.dailymotion.com/services/oembed'
17
+ "http://www.dailymotion.com/services/oembed"
19
18
  end
20
-
21
19
  end
22
20
  end
21
+
@@ -0,0 +1,13 @@
1
+ class FilmSnob
2
+ module Deprecated
3
+ def deprecated_alias(previous, replacement, options)
4
+ define_method(previous) do |*args, &block|
5
+ Kernel.warn "WARNING: ##{previous} is deprecated and " \
6
+ "will be removed in #{options[:removed_in]}. " \
7
+ "Please use ##{replacement} instead."
8
+ send(replacement, *args, &block)
9
+ end
10
+ end
11
+ end
12
+ end
13
+
@@ -2,3 +2,4 @@ class FilmSnob
2
2
  class NotSupportedURLError < StandardError; end
3
3
  class NotEmbeddableError < StandardError; end
4
4
  end
5
+
@@ -15,3 +15,4 @@ class FilmSnob
15
15
  end
16
16
  end
17
17
  end
18
+
@@ -1,6 +1,5 @@
1
1
  class FilmSnob
2
2
  class Hulu < VideoSite
3
-
4
3
  def self.valid_url_patterns
5
4
  [
6
5
  %r{https?://(?:(?:www).)?hulu.com/watch/(\d+)}
@@ -8,12 +7,12 @@ class FilmSnob
8
7
  end
9
8
 
10
9
  def self.oembed_endpoint
11
- 'http://www.hulu.com/api/oembed.json'
10
+ "http://www.hulu.com/api/oembed.json"
12
11
  end
13
12
 
14
13
  def clean_url
15
14
  @clean_url ||= "http://www.hulu.com/watch/#{id}"
16
15
  end
17
-
18
16
  end
19
17
  end
18
+
@@ -10,7 +10,7 @@ class FilmSnob
10
10
  end
11
11
 
12
12
  def self.oembed_endpoint
13
- 'http://api.instagram.com/oembed'
13
+ "http://api.instagram.com/oembed"
14
14
  end
15
15
 
16
16
  def clean_url
@@ -18,11 +18,20 @@ class FilmSnob
18
18
  end
19
19
 
20
20
  def html
21
- # instagram's oembed response does not include html, so we need to construct it
21
+ # instagram's oembed response does not include html,
22
+ # so we need to construct it
22
23
  # but first we need to ensure that the response was good
23
24
  # which we do by checking for the presence of the title,
24
- # which will raise an exception if it's not present
25
- title && %{<iframe src="//instagram.com/p/#{id}/embed/" width="612" height="710" frameborder="0" scrolling="no" allowtransparency="true"></iframe>}
25
+ # which will raise an exception if it"s not present
26
+ title && constructed_html
27
+ end
28
+
29
+ private
30
+
31
+ def constructed_html
32
+ "<iframe src='//instagram.com/p/#{id}/embed/' width='612' height='710' " \
33
+ "frameborder='0' scrolling='no' allowtransparency='true'></iframe>"
26
34
  end
27
35
  end
28
36
  end
37
+
@@ -8,7 +8,6 @@ require "film_snob/dailymotion"
8
8
 
9
9
  class FilmSnob
10
10
  class UrlToVideo
11
-
12
11
  VIDEO_SITES = [
13
12
  Vimeo,
14
13
  YouTube,
@@ -27,18 +26,18 @@ class FilmSnob
27
26
  end
28
27
 
29
28
  def video
30
- site.nil?? nil : site.new(url, options)
29
+ site.nil? ? nil : site.new(url, options)
31
30
  end
32
31
 
33
32
  private
34
33
 
35
- def site
36
- @site ||= VIDEO_SITES.find do |site|
37
- site.valid_url_patterns.any? do |pattern|
38
- pattern.match(url)
39
- end
34
+ def site
35
+ @site ||= VIDEO_SITES.find do |site|
36
+ site.valid_url_patterns.any? do |pattern|
37
+ pattern.match(url)
40
38
  end
41
39
  end
42
-
40
+ end
43
41
  end
44
42
  end
43
+
@@ -1,3 +1,4 @@
1
1
  class FilmSnob
2
- VERSION = "0.3.13"
2
+ VERSION = "0.4.0"
3
3
  end
4
+
@@ -1,10 +1,9 @@
1
- require 'net/http'
2
- require 'json'
1
+ require "net/http"
2
+ require "json"
3
3
 
4
4
  class FilmSnob
5
5
  class VideoSite
6
6
  attr_reader :url, :options
7
-
8
7
  def initialize(url, options)
9
8
  @url = url
10
9
  @options = options
@@ -15,7 +14,7 @@ class FilmSnob
15
14
  end
16
15
 
17
16
  def site
18
- @site ||= self.class.to_s.split('::').last.downcase.to_sym
17
+ @site ||= self.class.to_s.split("::").last.downcase.to_sym
19
18
  end
20
19
 
21
20
  def self.valid_url_patterns
@@ -23,7 +22,7 @@ class FilmSnob
23
22
  end
24
23
 
25
24
  def self.oembed_endpoint
26
- ''
25
+ ""
27
26
  end
28
27
 
29
28
  def self.http
@@ -33,7 +32,7 @@ class FilmSnob
33
32
  end
34
33
 
35
34
  def self.use_ssl?
36
- 'https' == uri.scheme
35
+ "https" == uri.scheme
37
36
  end
38
37
 
39
38
  def title
@@ -46,43 +45,43 @@ class FilmSnob
46
45
 
47
46
  private
48
47
 
49
- def not_embeddable!
50
- raise NotEmbeddableError, "#{clean_url} is not embeddable"
51
- end
48
+ def not_embeddable!
49
+ raise NotEmbeddableError, "#{clean_url} is not embeddable"
50
+ end
52
51
 
53
- def self.uri
54
- URI.parse(oembed_endpoint)
55
- end
52
+ def self.uri
53
+ URI.parse(oembed_endpoint)
54
+ end
56
55
 
57
- def lookup(attribute)
58
- oembed[attribute.to_s] || not_embeddable!
59
- end
56
+ def lookup(attribute)
57
+ oembed[attribute.to_s] || not_embeddable!
58
+ end
60
59
 
61
- def matching_pattern
62
- self.class.valid_url_patterns.find do |pattern|
63
- pattern.match(url)
64
- end
60
+ def matching_pattern
61
+ self.class.valid_url_patterns.find do |pattern|
62
+ pattern.match(url)
65
63
  end
64
+ end
66
65
 
67
- def oembed
68
- @oembed ||= JSON.parse response.body
69
- rescue
70
- @oembed = {}
71
- end
66
+ def oembed
67
+ @oembed ||= JSON.parse response.body
68
+ rescue
69
+ @oembed = {}
70
+ end
72
71
 
73
- def response
74
- self.class.http.request get
75
- end
72
+ def response
73
+ self.class.http.request get
74
+ end
76
75
 
77
- def get
78
- Net::HTTP::Get.new uri.request_uri
79
- end
76
+ def get
77
+ Net::HTTP::Get.new uri.request_uri
78
+ end
80
79
 
81
- def uri
82
- URI(self.class.oembed_endpoint).tap do |uri|
83
- uri.query = URI.encode_www_form({ url: clean_url }.merge(options))
84
- end
80
+ def uri
81
+ URI(self.class.oembed_endpoint).tap do |uri|
82
+ uri.query = URI.encode_www_form({ url: clean_url }.merge(options))
85
83
  end
86
-
84
+ end
87
85
  end
88
86
  end
87
+
@@ -2,7 +2,6 @@ require "film_snob/video_site"
2
2
 
3
3
  class FilmSnob
4
4
  class Vimeo < VideoSite
5
-
6
5
  def self.valid_url_patterns
7
6
  [
8
7
  %r{https?://vimeo.com/(\d{1,})},
@@ -16,8 +15,8 @@ class FilmSnob
16
15
  end
17
16
 
18
17
  def self.oembed_endpoint
19
- 'http://vimeo.com/api/oembed.json'
18
+ "http://vimeo.com/api/oembed.json"
20
19
  end
21
-
22
20
  end
23
21
  end
22
+
@@ -1,20 +1,22 @@
1
1
  class FilmSnob
2
2
  class YouTube < VideoSite
3
-
4
3
  def self.valid_url_patterns
5
4
  [
6
- %r{https?://(?:(?:www|m).)?youtube.com/watch\?(?:feature=[\w\.]+&)?v=([\w\d\-_]+)},
5
+ %r{
6
+ https?://(?:(?:www|m).)?youtube.com/watch\?
7
+ (?:feature=[\w\.]+&)?v=([\w\d\-_]+)
8
+ }x,
7
9
  %r{https?://(?:(?:www|m).)?youtu.be/([\w\d\-_]+)}
8
10
  ]
9
11
  end
10
12
 
11
13
  def self.oembed_endpoint
12
- 'https://www.youtube.com/oembed'
14
+ "https://www.youtube.com/oembed"
13
15
  end
14
16
 
15
17
  def clean_url
16
18
  @clean_url ||= "https://www.youtube.com/watch?v=#{id}"
17
19
  end
18
-
19
20
  end
20
21
  end
22
+
data/lib/film_snob.rb CHANGED
@@ -1,19 +1,24 @@
1
1
  require "film_snob/version"
2
2
  require "film_snob/url_to_video"
3
3
  require "film_snob/exceptions"
4
+ require "film_snob/deprecated"
4
5
 
5
6
  class FilmSnob
6
7
  attr_reader :url
7
8
 
8
- def initialize(url, options={})
9
+ extend Deprecated
10
+
11
+ def initialize(url, options = {})
9
12
  @url = url
10
13
  @video = UrlToVideo.new(url, options).video
11
14
  end
12
15
 
13
- def watchable?
16
+ def embeddable?
14
17
  !@video.nil?
15
18
  end
16
19
 
20
+ deprecated_alias :watchable?, :embeddable?, removed_in: "v1.0.0"
21
+
17
22
  def method_missing(message)
18
23
  if delegated_video_methods.include?(message)
19
24
  video.send(message)
@@ -24,17 +29,16 @@ class FilmSnob
24
29
 
25
30
  private
26
31
 
27
- def video
28
- if watchable?
29
- @video
30
- else
31
- raise NotSupportedURLError, "#{url} is not a supported URL"
32
- end
33
- end
34
-
35
- def delegated_video_methods
36
- [:site, :id, :clean_url, :title, :html]
32
+ def video
33
+ if embeddable?
34
+ @video
35
+ else
36
+ raise NotSupportedURLError, "#{url} is not a supported URL"
37
37
  end
38
+ end
38
39
 
40
+ def delegated_video_methods
41
+ [:site, :id, :clean_url, :title, :html]
42
+ end
39
43
  end
40
44
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,32 @@
1
+ require_relative "spec_helper"
2
+
3
+ class FilmSnob
4
+ describe Deprecated do
5
+
6
+ class Dog
7
+ extend Deprecated
8
+
9
+ deprecated_alias :woof, :bark, removed_in: "v4.0.0"
10
+
11
+ def bark
12
+ "bark"
13
+ end
14
+ end
15
+
16
+ let(:milo) { Dog.new }
17
+
18
+ describe "deprecated_alias" do
19
+ it "does not interfere with the current method" do
20
+ expect(Kernel).to_not receive(:warn)
21
+ milo.bark
22
+ end
23
+
24
+ it "creates an alias" do
25
+ expect(milo).to respond_to :woof
26
+ expect(Kernel).to receive(:warn)
27
+ expect(milo.woof).to eq "bark"
28
+ end
29
+ end
30
+ end
31
+ end
32
+