Sha256: 5179575ff9c424b7069f937f49823619d17aa5e4e6e30840be77d22a05df4c2c

Contents?: true

Size: 983 Bytes

Versions: 2

Compression:

Stored size: 983 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'spec_helper'
require 'fileutils'

include FileUtils

describe Scissor::SoundFile do
  before do
    @mp3 = Scissor::SoundFile.new_from_filename(fixture('sample.mp3'))
    @wav = Scissor::SoundFile.new_from_filename(fixture('sine.wav'))
    @m4a = Scissor::SoundFile.new_from_filename(fixture('sine.m4a'))
  end

  after do
  end

  it "raise error if unknown file format" do
    lambda {
      Scissor::SoundFile.new_from_filename(fixture('foo.bar'))
    }.should raise_error(Scissor::SoundFile::UnknownFormat)
  end

  it "should get length" do
    @mp3.length.should be_within(0.1).of(178.1)
    @wav.length.should eql(1.0)
    @m4a.length.should be_within(0.1).of(1.0)
  end

  describe '#mono?' do
    it "should return true if sound file is mono" do
      @mp3.should be_mono
      @wav.should_not be_mono
      @m4a.should_not be_mono

      Scissor::SoundFile.new_from_filename(fixture('mono.wav')).should be_mono
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scissor-0.6.0 spec/sound_file_spec.rb
scissor-0.5.0 spec/sound_file_spec.rb