Sha256: 2f6eef124f91c43320a48b538e67a2828f2cc87cd57640ab21cc3f544454b4fd

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
#
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
# reproduction, modification, or disclosure of this program is
# strictly prohibited. Any use of this program by an authorized
# licensee is strictly subject to the terms and conditions,
# including confidentiality obligations, set forth in the applicable
# License Agreement between RightScale.com, Inc. and
# the licensee

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

describe RightConf::BuildConfigurator do

  before(:each) do
    lang = RightConf::Language.parse('build { path "../source" }')
    @configurator = lang.configurators.first
    [:report_check, :report_result, :report_success].each do |meth|
      flexmock(@configurator).should_receive(meth)
    end
    flexmock(@configurator).should_receive(:report_fatal).and_return { |*args| raise args.join(' ') }
  end

  it 'should build' do
    flexmock(Dir).should_receive(:chdir).with('../source', Proc).once.and_yield
    should_execute('./configure', {:abort_on_failure=>"Failed to run ./configure"}).once.ordered
    should_execute('make', {:abort_on_failure=>"Failed to run make"}).once.ordered
    should_sudo('echo').once.ordered
    should_sudo('make', 'install', {:abort_on_failure=>"Failed to run make install"}).once.ordered
    @configurator.run
  end

  it 'should honor only_if' do
    @configurator.instance_eval { only_if('false') }
    should_execute.and_return { raise "Command should not execute" }
    @configurator.run
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rconf-0.7.8 spec/configurators/build_configurator_spec.rb