Add tests for the rc command

This commit is contained in:
Trae Robrock
2013-07-17 08:04:34 -07:00
parent 8e06beced6
commit 4b20c7224e

View File

@@ -100,6 +100,44 @@ describe 'homesick' do
end end
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 describe 'symlink' do
let(:castle) { given_castle('glencairn') } let(:castle) { given_castle('glencairn') }