spec/configurators/ruby_configurator_spec.rb in rconf-1.0.8 vs spec/configurators/ruby_configurator_spec.rb in rconf-1.0.9
- old
+ new
@@ -50,25 +50,30 @@
end
context "without rbenv installed" do
before(:each) do
+ should_execute("git", "--version").once.and_return(success_result)
+ should_execute("git", "clone", "git://github.com/sstephenson/rbenv.git", "#{ENV['HOME']}/.rbenv", {:abort_on_failure=>"Git clone of rbnev failed - server down?"}).once.and_return(success_result)
+ should_execute("git", "clone", "git://github.com/sstephenson/ruby-build.git", "#{ENV['HOME']}/.rbenv/plugins/ruby-build", {:abort_on_failure=>"Git clone of ruby-build failed - server down?"}).once.and_return(success_result)
+
should_execute('rvm').once.and_return(failure_result)
should_execute('rbenv').once.and_return(failure_result)
flexmock(File).should_receive(:exist?).with(File.join(ENV['HOME'], '.rbenv', 'bin', 'rbenv')).and_return(false)
+
+ flexmock(FileUtils).should_receive(:cp).with(/.*\/patches\/ree-1.8.7-2012.02-rs-custom/, "#{ENV['HOME']}/.rbenv/plugins/ruby-build/share/ruby-build/ree-1.8.7-2012.02").and_return(true)
+ flexmock(FileUtils).should_receive(:mkdir_p).with("#{ENV['HOME']}/.rbenv/plugins/ruby-build").and_return(true)
+ flexmock(Kernel).should_receive(:system).and_return(true)
should_execute('which', 'ruby').and_return(success_result(File.join(ENV['HOME'], '.rbenv', 'shims', 'ruby')))
end
it 'should install rbenv and ruby-build' do
- flexmock(RightConf::PackageInstaller).should_receive(:install).with('rbenv', Hash).once
- flexmock(RightConf::PackageInstaller).should_receive(:install).with('ruby-build', Hash).once
should_execute('rbenv', 'local', '42').and_return(success_result)
@configurator.run_linux
end
it 'should install ruby if needed' do
- flexmock(RightConf::PackageInstaller).should_receive(:install).with('rbenv', Hash).once
- flexmock(RightConf::PackageInstaller).should_receive(:install).with('ruby-build', Hash).once
+ flexmock(RightConf::Platform).should_receive(:dispatch).with(Proc)
should_execute('rbenv', 'local', '42').and_return(failure_result)
flexmock(RightConf::Platform).should_receive(:dispatch).with('42', Proc)
should_execute('rbenv', 'local', '42').and_return(success_result)
@configurator.run_linux
end