Sha256: 8e24408ab66b404a2819fa0cc97db085a2b93dfbee9bfe6faf148daaa83bfd9c
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require "youtube_id" describe YoutubeID do describe ".from" do subject { described_class.from url } %w(http https).each do |protocol| context "direct format" "/v/:id" do let(:url) { "#{protocol}://www.youtube.com/v/RCUkmUXMd_k" } it { should == "RCUkmUXMd_k" } end context "legacy embed format" "/v/:id?version=3&hl=en_US&rel=0" do let(:url) { "#{protocol}://www.youtube.com/v/RCUkmUXMd_k?version=3&hl=en_US&rel=0" } it { should == "RCUkmUXMd_k" } end context "embed format" "/embed/RCUkmUXMd_k?rel=0" do let(:url) { "#{protocol}://www.youtube.com/embed/RCUkmUXMd_k?rel=0" } it { should == "RCUkmUXMd_k" } context "without parameters" do let(:url) { "#{protocol}://www.youtube.com/embed/RCUkmUXMd_k" } it { should == "RCUkmUXMd_k" } end end context "standard format", "/watch?v=:id" do let(:url) { "#{protocol}://www.youtube.com/watch?v=RCUkmUXMd_k" } it { should == "RCUkmUXMd_k" } context "with additional parameters" do let(:url) { "#{protocol}://www.youtube.com/watch?v=RCUkmUXMd_k&feature=related" } it { should == "RCUkmUXMd_k" } end context "with start time specification" do let(:url) { "#{protocol}://www.youtube.com/watch?v=RCUkmUXMd_k#t=0m10s" } it { should == "RCUkmUXMd_k" } end end context "user video format", "/user/name#p/a/u/0/:id" do let(:url) { "#{protocol}://www.youtube.com/user/ForceD3strategy#p/a/u/0/8WVTOUh53QY" } it { should == "8WVTOUh53QY" } end context "shor url format", "//youtu.be/RCUkmUXMd_k" do let(:url) { "#{protocol}://youtu.be/RCUkmUXMd_k" } it { should == "RCUkmUXMd_k" } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
youtube_id-0.0.1 | spec/youtube_id_spec.rb |