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') }