Sha256: 9d60b50b18bfc62271c202b8032d8ee7ce1e761ca160fc6d990d55efbfc0e565

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'app-store-emigrant'
require 'helpers'
require 'minitest/spec'
require 'minitest/autorun'

include AppStore::Emigrant

describe Library do
  
  before do
    @library = Library.new(ROOT + '/fixtures/dummy-library')
  end
  
  it 'must be located in a valid directory' do
    @library.must_be_instance_of Library
    
    lambda do
      Library.new(ROOT + '/non-existent-library')
    end.must_raise Library::DoesNotExist
  end
  
  it 'will gracefully and lazily load applications' do
    @library.instance_variable_get('@apps').must_be_nil
    @library.apps.must_be_instance_of Array
    @library.apps.length.must_equal 3
  end
  
  it 'can find applications by (partial) filename' do
    @library.find('Dummy').length.must_equal 1
    @library.find('GTA').length.must_equal 1
    @library.find('Soosiz').length.must_equal 1
  end
  
  it 'can get applications by id' do
    @library.get(344186162).filename.must_equal 'GTA.ipa'
    @library.get(331891505).filename.must_equal 'Soosiz.ipa'
  end
  
  it 'can load cloud data in bulk' do
    gta = @library.find('GTA').first
    soosiz = @library.find('Soosiz').first
    gta.instance_variable_get('@clouddata').must_be_nil
    soosiz.instance_variable_get('@clouddata').must_be_nil
    
    @library.clouddata!
    
    gta.instance_variable_get('@clouddata').must_be_instance_of Hash
    soosiz.instance_variable_get('@clouddata').must_be_instance_of Hash
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
app-store-emigrant-0.0.7 specs/library.rb
app-store-emigrant-0.0.6 specs/library.rb
app-store-emigrant-0.0.5 specs/library.rb