Sha256: 8a7cb9a53ee802b0fb32371f9b14a3b1ffea52236897d7bd1176315b19c62fc9

Contents?: true

Size: 1.65 KB

Versions: 10

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'
require 'zlib'
require 'gemirro/versions_file'

# VersionsFile tests
module Gemirro
  describe 'VersionsFile' do
    include FakeFS::SpecHelpers

    it 'should be initialized' do
      @versions_file = VersionsFile.new([['gemirro', '0.0.1'],
                                         ['gemirro', '0.0.2']])
      expect(@versions_file.versions).to eq([['gemirro', '0.0.1'],
                                             ['gemirro', '0.0.2']])
      expect(@versions_file.versions_hash).to eq(
        'gemirro' => [
          ['gemirro', '0.0.1'],
          ['gemirro', '0.0.2']
        ]
      )
    end

    it 'should load versions file' do
      spec = StringIO.new('w')
      w_gz = Zlib::GzipWriter.new(spec)
      w_gz.write(Marshal.dump([['gemirro', '0.0.1'],
                               ['gemirro', '0.0.2']]))
      w_gz.close
      prerelease = StringIO.new('w')
      w_gz = Zlib::GzipWriter.new(prerelease)
      w_gz.write(Marshal.dump([['gemirro', '0.0.1.alpha1'],
                               ['gemirro', '0.0.2.alpha2']]))
      w_gz.close

      result = VersionsFile.load(spec.string, prerelease.string)
      expect(result).to be_a(VersionsFile)

      expect(result.versions).to eq([['gemirro', '0.0.1'],
                                     ['gemirro', '0.0.2'],
                                     ['gemirro', '0.0.1.alpha1'],
                                     ['gemirro', '0.0.2.alpha2']])
      expect(result.versions_hash).to eq(
        'gemirro' => [
          ['gemirro', '0.0.1'],
          ['gemirro', '0.0.2'],
          ['gemirro', '0.0.1.alpha1'],
          ['gemirro', '0.0.2.alpha2']
        ]
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gemirro-1.5.0 spec/gemirro/versions_file_spec.rb
gemirro-1.4.0 spec/gemirro/versions_file_spec.rb
gemirro-1.3.0 spec/gemirro/versions_file_spec.rb
gemirro-1.2.0 spec/gemirro/versions_file_spec.rb
gemirro-1.1.1 spec/gemirro/versions_file_spec.rb
gemirro-1.1.0 spec/gemirro/versions_file_spec.rb
gemirro-1.0.0 spec/gemirro/versions_file_spec.rb
gemirro-0.16.0 spec/gemirro/versions_file_spec.rb
gemirro-0.15.0 spec/gemirro/versions_file_spec.rb
gemirro-0.14.0 spec/gemirro/versions_file_spec.rb