spec/ffprober_spec.rb in ffprober-0.0.1 vs spec/ffprober_spec.rb in ffprober-0.0.2
- old
+ new
@@ -1,48 +1,70 @@
# encoding: utf-8
require 'spec_helper'
describe Ffprober do
- before :each do
- @ffprobe = Ffprober::Parser.from_json(File.read('spec/assets/301-extracting_a_ruby_gem.json'))
- end
-
- describe "format" do
- it "should determine the correct filename" do
- @ffprobe.format.filename.should eq("301-extracting-a-ruby-gem.mp4")
+ describe "from_file", :if => Ffprober::Parser.ffprobe_version_valid? do
+ before :each do
+ @ffprobe = Ffprober::Parser.from_file('spec/assets/301-extracting_a_ruby_gem.m4v')
end
- it "should find the correct size" do
- @ffprobe.format.size.should eq("44772490")
- end
+ describe "format" do
+ it "should determine the correct filename" do
+ @ffprobe.format.filename.should eq("spec/assets/301-extracting_a_ruby_gem.m4v")
+ end
- it "should find the correct bit_rate" do
- @ffprobe.format.bit_rate.should eq("361309")
+ it "should find the correct size" do
+ @ffprobe.format.size.should eq("130694")
+ end
+
+ it "should find the correct bit_rate" do
+ @ffprobe.format.bit_rate.should eq("502669")
+ end
end
+
end
- describe "audio_streams" do
- it "should determine the correct number of audio streams" do
- @ffprobe.audio_streams.count.should eq(1)
+ describe "from_json" do
+ before :each do
+ @ffprobe = Ffprober::Parser.from_json(File.read('spec/assets/301-extracting_a_ruby_gem.json'))
end
- it "should determine the correct sample rate of the first audio stream" do
- @ffprobe.audio_streams.first.sample_rate.should eq("48000")
- end
+ describe "format" do
+ it "should determine the correct filename" do
+ @ffprobe.format.filename.should eq("301-extracting-a-ruby-gem.mp4")
+ end
- end
+ it "should find the correct size" do
+ @ffprobe.format.size.should eq("44772490")
+ end
- describe "video_streams" do
- it "should determine the correct width of the first video streams" do
- @ffprobe.video_streams.first.width.should eq(960)
+ it "should find the correct bit_rate" do
+ @ffprobe.format.bit_rate.should eq("361309")
+ end
end
- it "should determine the correct width of the first video streams" do
- @ffprobe.video_streams.first.height.should eq(600)
+ describe "audio_streams" do
+ it "should determine the correct number of audio streams" do
+ @ffprobe.audio_streams.count.should eq(1)
+ end
+
+ it "should determine the correct sample rate of the first audio stream" do
+ @ffprobe.audio_streams.first.sample_rate.should eq("48000")
+ end
+
end
- it "should determine the correct number of video streams" do
- @ffprobe.video_streams.count.should eq(1)
+ describe "video_streams" do
+ it "should determine the correct width of the first video streams" do
+ @ffprobe.video_streams.first.width.should eq(960)
+ end
+
+ it "should determine the correct width of the first video streams" do
+ @ffprobe.video_streams.first.height.should eq(600)
+ end
+
+ it "should determine the correct number of video streams" do
+ @ffprobe.video_streams.count.should eq(1)
+ end
end
end
-
end