From 294fb3d4ce6388f6847e7c7aa1146cb671eee898 Mon Sep 17 00:00:00 2001 From: Trae Robrock Date: Wed, 17 Jul 2013 08:04:34 -0700 Subject: [PATCH] Add tests for the rc command --- spec/homesick_spec.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/spec/homesick_spec.rb b/spec/homesick_spec.rb index 98cd2f8..6520642 100644 --- a/spec/homesick_spec.rb +++ b/spec/homesick_spec.rb @@ -101,6 +101,44 @@ describe 'homesick' do end end + describe 'rc' do + let(:castle) { given_castle('glencairn') } + + context 'when told to do so' do + before do + expect($stdout).to receive(:print) + expect($stdin).to receive(:gets).and_return('y') + end + + it 'executes the .homesickrc' do + castle.file('.homesickrc') do |file| + file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }" + end + + homesick.rc castle + + castle.join('testing').should exist + end + end + + context 'when told not to do so' do + before do + expect($stdout).to receive(:print) + expect($stdin).to receive(:gets).and_return('n') + end + + it 'does not execute the .homesickrc' do + castle.file('.homesickrc') do |file| + file << "File.open(Dir.pwd + '/testing', 'w') { |f| f.print 'testing' }" + end + + homesick.rc castle + + castle.join('testing').should_not exist + end + end + end + describe 'symlink' do let(:castle) { given_castle('glencairn') }