Sha256: 3e1a09606cf99729baf11f725b9b34a76501cff053a26609e6870c1c43360384

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

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

# The CocoaPods namespace
#
module CLAide
  describe Command::GemIndexCache do
    before do
      @cache = Command::GemIndexCache.new
      UI_OUT.reopen
    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
      out = UI_OUT.string
      out.should.include('Downloading Rubygem specification index...')
      out.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_OUT.string.should.include('Downloading Rubygem specification index...')
      UI_OUT.string.should.include('Error downloading Rubygem specification')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
claide-plugins-0.9.2 spec/command/gem_index_cache_spec.rb
claide-plugins-0.9.1 spec/command/gem_index_cache_spec.rb
claide-plugins-0.9.0 spec/command/gem_index_cache_spec.rb