Sha256: 95f3d78423468cc5384d3365cd7baf02a938217a5d6cecd80cbcd6ade2f88824

Contents?: true

Size: 1.31 KB

Versions: 67

Compression:

Stored size: 1.31 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.join(File.dirname(__FILE__), 'spec_helper')

describe RightConf::Command do

  def success_result
    RightConf::CommandResult.new(0, '')
  end

  def failed_result
    RightConf::CommandResult.new(1, '')
  end

  it 'should execute' do
    flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', '42', Proc).once.and_return(success_result)
    RightConf::Command.execute('test', '42')
  end

  it 'should report fatal errors when required to' do
    flexmock(RightConf::Platform.instance).should_receive(:dispatch).with('test', '42', 
       Proc).once.and_return(failed_result)
    flexmock(RightConf::Command.instance).should_receive(:report_fatal).once.with("FAILED: 'test 42' returned\n1")
    RightConf::Command.execute('test', '42', :abort_on_failure => 'FAILED')
  end

end


Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
rconf-0.5.9 spec/command_spec.rb
rconf-0.5.8 spec/command_spec.rb
rconf-0.5.6 spec/command_spec.rb
rconf-0.5.5 spec/command_spec.rb
rconf-0.5.3 spec/command_spec.rb
rconf-0.5.1 spec/command_spec.rb
rconf-0.5.0 spec/command_spec.rb