Sha256: 6c854b1dcf891c27830d0956f27293f0a11d8da409cbda78920f86d030f24853

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 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::FetchError.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

4 entries across 4 versions & 1 rubygems

Version Path
cocoapods-plugins-0.4.1 spec/command/gem_index_cache_spec.rb
cocoapods-plugins-0.4.0 spec/command/gem_index_cache_spec.rb
cocoapods-plugins-0.3.2 spec/command/gem_index_cache_spec.rb
cocoapods-plugins-0.3.1 spec/command/gem_index_cache_spec.rb