spec/configurators/bundler_configurator_spec.rb in rconf-0.6.25 vs spec/configurators/bundler_configurator_spec.rb in rconf-0.6.30

- old
+ new

@@ -18,30 +18,36 @@ end before(:each) do lang = RightConf::Language.parse('bundler { version "0" }') @configurator = lang.configurators.first - [:report_check, :report_result, :report_fatal, :report_success].each do |meth| + [: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(' ') } + RightConf::Command.instance.instance_variable_set(:@rvm_prefix, 'r@g') end + after(:each) do + RightConf::Command.instance.instance_variable_set(:@rvm_prefix, nil) + end + it 'should succeed when bundler succeeds' do - flexmock(RightConf::Command.instance).should_receive(:execute).once.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with( 'bundle', '--version').and_return(success_result('0')) - flexmock(RightConf::Command.instance).should_receive(:execute).once.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with( 'bundle','_0_', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result) @configurator.run_linux end it 'should install bunlder if needed' do - flexmock(RightConf::Command.instance).should_receive(:execute).twice.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).twice.with( 'bundle', '--version').and_return(success_result('1')) - flexmock(RightConf::Command.instance).should_receive(:execute).once.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with( 'bundle','_0_', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result) - flexmock(RightConf::Command.instance).should_receive(:execute).once.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with( 'gem', 'uninstall', 'bundler', '-a', '-x').and_return(success_result) - flexmock(RightConf::Command.instance).should_receive(:execute).once.with( + flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with( 'gem', 'install', 'bundler', '-v', '0', '--no-ri', '--no-rdoc', {:abort_on_failure=>"Failed to install bundler"}).once.and_return(success_result) @configurator.run_linux end