Sha256: 4272b10f69a4c9a2271fb821672a1fea265b7d75c08d4761f98c1e956ffa1a0d

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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
      url = "http://www.youtube.com/watch?feature=youtube_gdata&v=fq-xGD_thXo"
      title = "Pete Meets Olympic Freestyle Skier Torin Yater-Wallace"
      film = FilmSnob.new(url)
      expect(film).to be_embeddable
      expect(film.id).to eq "fq-xGD_thXo"
      expect { film.html }.to_not raise_error
      expect(film.title).to eq title
    end
  end

  it "can handle even more junked up URLs" do
    VCR.use_cassette("youtube/dilla") do
      url = "http://www.youtube.com/watch?feature=youtu.be&v=lC0JFXw_6kQ"
      title = "BINKBEATS Beats Unraveled #6: J. Dilla Live Mixtape"
      film = FilmSnob.new(url)

      expect(film).to be_embeddable
      expect(film.id).to eq "lC0JFXw_6kQ"
      expect { film.html }.to_not raise_error
      expect(film.title).to eq title
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
film_snob-0.5.0 spec/youtube_spec.rb