Sha256: d81d375f827ff7682d8b5e72529b0cdb6533eff9c4d7bc46317c22351f6abc9b

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe Puppet::Module::Tool::Repository do
  describe 'instances' do
    before do
      @repository = described_class.new('http://fake.com')
    end

    describe '#contact' do
      before do
        Net::HTTP.expects(:start)
      end
      context "when not given an :authenticate option" do
        it "should authenticate" do
          @repository.expects(:authenticate).never
          @repository.contact(nil)
        end        
      end
      context "when given an :authenticate option" do
        it "should authenticate" do
          @repository.expects(:authenticate)
          @repository.contact(nil, :authenticate => true)
        end
      end
    end

    describe '#authenticate' do
      before do
        @request = stub
        @repository.expects(:header)
        @repository.expects(:prompt).twice        
      end

      it "should set basic auth on the request" do
        @request.expects(:basic_auth)
        @repository.authenticate(@request)
      end      
    end

    describe '#retrieve' do
      before do
        @uri = URI.parse('http://some.url.com')
        @repository.cache.expects(:retrieve).with(@uri)
      end
      it "should access the cache" do
        @repository.retrieve(@uri)
      end
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-module-0.3.4 spec/unit/repository_spec.rb
puppet-module-0.3.3 spec/unit/repository_spec.rb
puppet-module-0.3.2 spec/unit/repository_spec.rb
puppet-module-0.3.0 spec/unit/repository_spec.rb