1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
require 'spec_helper'
describe Vim::AddonManager do
it 'installs addons' do
addon_manager.install addons('foo')
expect(target_dir).to have_file('syntax/foo.vim')
end
it 'installs multiple addons at once' do
addon_manager.install addons('foo', 'bar')
expect(target_dir).to have_file('syntax/foo.vim')
expect(target_dir).to have_file('syntax/bar.vim')
end
it 'removes addons' do
addon_manager.install addons('foo')
addon_manager.remove addons('foo')
expect(target_dir).to_not have_file('syntax/foo.vim')
end
it 'fixes broken addons after they are upgraded to the new style' do
Dir.chdir target_dir.path do
FileUtils.mkdir_p 'syntax'
FileUtils.ln_s '/non/existing/path', 'syntax/newstylemigrated.vim'
end
addon_manager.upgrade_from_legacy(registry.to_a)
expect(target_dir).to_not have_symlink('syntax/newstylemigrated.vim')
expect(target_dir).to have_file('vam/newstylemigrated/syntax/newstylemigrated.vim')
end
it 'disables addons' do
addon_list = addons('foo')
addon_manager.install(addon_list)
addon_manager.disable(addon_list)
output = File.readlines(override_file).map(&:strip)
expect(output).to include(addon_list.first.disabled_by_line)
end
it 're-enables addons' do
addon_list = addons('foo')
addon_manager.install(addon_list)
addon_manager.disable(addon_list)
expect(File.exist?(override_file)).to eq(true)
addon_manager.enable(addon_list)
expect(File.exist?(override_file)).to eq(false)
end
end
|