Sha256: 3a9a1db45b64138fb24334f2e9bcb8c6c5a8e26e1a4258a6ad53f78b0f5881ed

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe Sprinkle::Installers::Gem do

  before do
    @gem = 'rails'
    @version = '2.0.2'
    @options = { :source => 'http://gems.github.com/' }
  end

  def create_gem(gem, version = nil, options = {}, &block)
    @package = mock(Sprinkle::Package, :name => gem, :version => version, :source => nil)
    Sprinkle::Installers::Gem.new(@package, gem, options, &block)
  end

  describe 'when created' do

    before do
      @installer = create_gem @gem, @version, @options
    end

    it 'should accept a single package to install' do
      @installer.gem.should == @gem
    end

    it 'should optionally store a version of the gem to install' do
      @installer.version.should == '2.0.2'
    end

    it 'should optionally store a source location of the gem to install' do
      @installer.source.should == 'http://gems.github.com/'
    end

  end

  describe 'during installation' do

    describe 'without a version' do

      before do
        @installer = create_gem @gem
      end

      it 'should invoke the gem installer for all specified package' do
        @installer.send(:install_sequence).should == "gem install #{@gem}"
      end

    end

    describe 'with a specific version' do

      before do
        @installer = create_gem @gem, @version
      end

      it 'should install a specific version if defined' do
        @installer.send(:install_sequence).should == "gem install #{@gem} --version '#{@version}'"
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crafterm-sprinkle-0.1.0 spec/sprinkle/installers/gem_spec.rb
crafterm-sprinkle-0.1.1 spec/sprinkle/installers/gem_spec.rb
crafterm-sprinkle-0.1.2 spec/sprinkle/installers/gem_spec.rb