require 'spec_helper' describe MediaMagick::Video::Parser do describe 'youtube' do describe 'valid?' do context 'with a valid url' do subject { MediaMagick::Video::Parser.new('youtube.com/watch?v=FfUHkPf9D9k') } it { should be_valid } end context 'with a invalid url' do subject { MediaMagick::Video::Parser.new('youtube.com') } it { should_not be_valid } end end describe '#to_image' do it 'should return a file with video image' do video = MediaMagick::Video::Parser.new('youtube.com/watch?v=FfUHkPf9D9k') video.to_image.should be_instance_of(File) end end describe '#to_html' do it 'should return video html' do video = MediaMagick::Video::Parser.new('youtube.com/watch?v=FfUHkPf9D9k') video.to_html.should eq('') end end end describe 'vimeo' do describe 'valid?' do context 'with a valid url' do subject { MediaMagick::Video::Parser.new('vimeo.com/44539044') } it { should be_valid } end context 'with a invalid url' do subject { MediaMagick::Video::Parser.new('vimeo.com') } it { should_not be_valid } end end describe '#to_image' do it 'should return a file with video image' do video = MediaMagick::Video::Parser.new('vimeo.com/44539044') video.to_image.should be_instance_of(File) end end describe '#to_html' do it 'should return video html' do video = MediaMagick::Video::Parser.new('vimeo.com/44539044') video.to_html.should eq('') end end end end