Sha256: 89e382101c735887b4a105a7b27cf20a14cb1eb1ad6ca567dc1be85cccb06468

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

# -*- coding: utf-8 -*-
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

5 entries across 5 versions & 1 rubygems

Version Path
gemirro-0.13.3 spec/gemirro/versions_file_spec.rb
gemirro-0.13.2 spec/gemirro/versions_file_spec.rb
gemirro-0.13.1 spec/gemirro/versions_file_spec.rb
gemirro-0.12.0 spec/gemirro/versions_file_spec.rb
gemirro-0.11.0 spec/gemirro/versions_file_spec.rb