Sha256: 3e25d3a4c4bd2776b74830579ebf09d439f5d3d46804686c197dcb21c72fc9a1

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 KB

Contents

require File.dirname(__FILE__) + '/../../../lib/mp3file'
require File.dirname(__FILE__) + '/../../common_helpers'

include CommonHelpers

describe Mp3file::ID3v2::Version do
  describe Mp3file::ID3v2::ID3V2_2_0 do
    subject { Mp3file::ID3v2::ID3V2_2_0 }
    its(:vbig) { should == 2 }
    its(:vmaj) { should == 2 }
    its(:vmin) { should == 0 }
    its(:to_s) { should == 'ID3v2.2.0' }
    its(:to_byte_string) { should == "\x02\x00" }
  end

  describe Mp3file::ID3v2::ID3V2_3_0 do
    subject { Mp3file::ID3v2::ID3V2_3_0 }
    its(:vbig) { should == 2 }
    its(:vmaj) { should == 3 }
    its(:vmin) { should == 0 }
    its(:to_s) { should == 'ID3v2.3.0' }
    its(:to_byte_string) { should == "\x03\x00" }
  end

  describe Mp3file::ID3v2::ID3V2_4_0 do
    subject { Mp3file::ID3v2::ID3V2_4_0 }
    its(:vbig) { should == 2 }
    its(:vmaj) { should == 4 }
    its(:vmin) { should == 0 }
    its(:to_s) { should == 'ID3v2.4.0' }
    its(:to_byte_string) { should == "\x04\x00" }
  end

  describe "#<=>" do
    it("should recognize that ID3v2.2 < ID3v2.3") do
      (Mp3file::ID3v2::ID3V2_2_0 <=> Mp3file::ID3v2::ID3V2_3_0).should == -1
    end

    it("should recognize that ID3v2.4 > ID3v2.2") do
      (Mp3file::ID3v2::ID3V2_4_0 <=> Mp3file::ID3v2::ID3V2_2_0).should == 1
    end

    it("should recognize that ID3v2.3 == ID3v2.3") do
      (Mp3file::ID3v2::ID3V2_3_0 <=> Mp3file::ID3v2::ID3V2_3_0).should == 0
    end
  end

  describe "#new" do
    subject { Mp3file::ID3v2::Version.new(3, 1) }
    its(:vbig) { should == 2 }
    its(:vmaj) { should == 3 }
    its(:vmin) { should == 1 }
    its(:to_s) { should == 'ID3v2.3.1' }
    its(:to_byte_string) { should == "\x03\x01" }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mp3file-1.2.0 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.5 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.4 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.3 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.2 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.1 spec/mp3file/id3v2/version_spec.rb
mp3file-1.1.0 spec/mp3file/id3v2/version_spec.rb
mp3file-1.0.3 spec/mp3file/id3v2/version_spec.rb
mp3file-1.0.2 spec/mp3file/id3v2/version_spec.rb
mp3file-1.0.1 spec/mp3file/id3v2/version_spec.rb
mp3file-1.0.0 spec/mp3file/id3v2/version_spec.rb
mp3file-0.0.4 spec/mp3file/id3v2/version_spec.rb
mp3file-0.0.3 spec/mp3file/id3v2/version_spec.rb
mp3file-0.0.2 spec/mp3file/id3v2/version_spec.rb