Sha256: 9049074987204ca35886b09bb8f7224049a19f659829ea82f9676c43c62e6f09

Contents?: true

Size: 883 Bytes

Versions: 4

Compression:

Stored size: 883 Bytes

Contents

describe Rake::Funnel::Support::BinaryVersionReader do
  def binary_version(*version_parts)
    version = version_parts.map { |p| p.to_s + "\0" }.join(".\0")
    "F\0i\0l\0e\0V\0e\0r\0s\0i\0o\0n" + "\0" * 3 + version + "\0" * 3
  end

  let(:file) { 'some assembly' }

  before {
    allow(File).to receive(:binread).with(file).and_return(contents)
  }

  describe 'version can be read' do
    let(:version) { %w(1 2 3 4) }
    let(:contents) { "binary #{binary_version(*version)} binary" }

    it 'should yield all parts' do
      expect(described_class.read_from(file).file_version).to eq(version.join('.'))
    end
  end

  describe 'version cannot be read' do
    let(:contents) { 'this does not contain a version number' }

    it 'should yield empty VersionInfo' do
      expect(described_class.read_from(file).to_h).to be_empty
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre spec/rake/funnel/support/binary_version_reader_spec.rb
rake-funnel-0.3.1.pre spec/rake/funnel/support/binary_version_reader_spec.rb
rake-funnel-0.3.0.pre spec/rake/funnel/support/binary_version_reader_spec.rb
rake-funnel-0.2.0.pre spec/rake/funnel/support/binary_version_reader_spec.rb