Sha256: c9e8bae1c663db097f927f4422e6f242d2848c61d0a0f3857fbf7c8eb68ec0fa

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require_relative 'spec_helper'

describe FilmSnob::YouTube do
  it 'may not be embeddable' do
    VCR.use_cassette('youtube/bad_youtube_url') do
      snob = FilmSnob.new('http://youtube.com/watch?v=malformedid')
      expect{snob.html}.to raise_error(FilmSnob::NotEmbeddableError)
    end
  end

  it 'can handle junked up URLs' do
    VCR.use_cassette('youtube/pete') do
      film = FilmSnob.new('http://www.youtube.com/watch?feature=youtube_gdata&v=fq-xGD_thXo')
      expect(film).to be_watchable
      expect(film.id).to eq 'fq-xGD_thXo'
      expect{film.html}.to_not raise_error
      expect(film.title).to eq 'Pete Meets Olympic Freestyle Skier Torin Yater-Wallace'
    end
  end

  it 'can handle even more junked up URLs' do
    VCR.use_cassette('youtube/dilla') do
      film = FilmSnob.new('http://www.youtube.com/watch?feature=youtu.be&v=lC0JFXw_6kQ')

      expect(film).to be_watchable
      expect(film.id).to eq 'lC0JFXw_6kQ'
      expect{film.html}.to_not raise_error
      expect(film.title).to eq 'BINKBEATS Beats Unraveled #6: J. Dilla Live Mixtape'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
film_snob-0.3.13 spec/youtube_spec.rb