Sha256: 652fdb2b614b94127cc5508a7c3aa5466e3a3efce015988cd74ed6298c44c6cd

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))

# The CocoaPods namespace
#
module Pod
  describe Command::GemIndexCache do

    before do
      @cache = Command::GemIndexCache.new
      UI.output = ''
    end

    after do
      mocha_teardown
    end

    it 'notifies the user that it is downloading the spec index' do
      response = [{}, []]
      Gem::SpecFetcher.any_instance.stubs(:available_specs).returns(response)

      @cache.download_and_cache_specs
      UI.output.should.include('Downloading Rubygem specification index...')
      UI.output.should.not.include('Error downloading Rubygem specification')
    end

    it 'notifies the user when getting the spec index fails' do
      error = Gem::RemoteFetcher::UnknownHostError.new('no host', 'bad url')
      wrapper_error = stub(:error => error)
      response = [[], [wrapper_error]]
      Gem::SpecFetcher.any_instance.stubs(:available_specs).returns(response)

      @cache.download_and_cache_specs
      @cache.specs.should.be.empty?
      UI.output.should.include('Downloading Rubygem specification index...')
      UI.output.should.include('Error downloading Rubygem specification')
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-plugins-0.3.0 spec/command/gem_index_cache_spec.rb