spec/configurators/ruby_configurator_spec.rb in rconf-0.5.5 vs spec/configurators/ruby_configurator_spec.rb in rconf-0.5.6

- old
+ new

@@ -11,10 +11,12 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RightConf::RubyConfigurator do + RVM_VERSION = RightConf::RubyConfigurator::RVM_VERSION + def success_result(output=nil) flexmock('res', :success? => true, :output => output) end before(:each) do @@ -25,33 +27,33 @@ end end it 'should succeed on linux when rvm succeeds' do flexmock(RightConf::Command.instance).should_receive(:execute).once.with( - 'rvm', '--version').and_return(success_result("rvm #{RightConf::RubyConfigurator::RVM_VERSION}")) + 'rvm', '--version').and_return(success_result("rvm #{RVM_VERSION}")) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( - 'rvm', 'list').and_return(success_result("=> rvm #{RightConf::RubyConfigurator::RVM_VERSION}")) + 'rvm', 'list').and_return(success_result("=> rvm #{RVM_VERSION}")) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( 'rvm', 'use', '0').and_return(success_result('Using')) @configurator.run_linux end it 'should install rvm if needed' do - rvm_tar = "rvm-#{RightConf::RubyConfigurator::RVM_VERSION}.tar.gz" + rvm_tar = "rvm-#{RVM_VERSION}.tar.gz" flexmock(RightConf::Command.instance).should_receive(:execute).once.with( 'rvm', '--version').and_return(success_result("rvm")) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( - 'rvm', 'list').and_return(success_result("=> rvm #{RightConf::RubyConfigurator::RVM_VERSION}")) + 'rvm', 'list').and_return(success_result("=> rvm #{RVM_VERSION}")) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( 'curl', '-O', '-f', "http://rvm.beginrescueend.com/releases/#{rvm_tar}", - {:abort_on_failure=>"Failed to download rvm #{RightConf::RubyConfigurator::RVM_VERSION}"}).and_return(success_result) + {:abort_on_failure=>"Failed to download rvm #{RVM_VERSION}"}).and_return(success_result) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( 'tar', 'zxf', rvm_tar, - {:abort_on_failure=>"Failed to extract rvm tgz from /Users/raphael/src/right_env/rvm-1.2.6.tar.gz"}).and_return(success_result) + {:abort_on_failure=>"Failed to extract rvm tgz from #{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', "rvm-#{RVM_VERSION}.tar.gz"))}"}).and_return(success_result) flexmock(Dir).should_receive(:chdir).and_yield flexmock(RightConf::Command.instance).should_receive(:execute).once.with( - './install', {:abort_on_failure=>"Failed to install rvm #{RightConf::RubyConfigurator::RVM_VERSION}"}).and_return(success_result) + './install', {:abort_on_failure=>"Failed to install rvm #{RVM_VERSION}"}).and_return(success_result) flexmock(RightConf::Command.instance).should_receive(:execute).once.with( 'rvm', 'use', '0').and_return(success_result('Using')) @configurator.run_linux end