1
0
Fork 0
mirror of synced 2024-07-02 05:21:09 -04:00
ultimate-vim/sources_non_forked/vim-scala/spec/spec_helper.rb
2017-08-25 17:35:23 -07:00

45 lines
804 B
Ruby

require 'vimrunner'
require 'tempfile'
PWD = File.expand_path File.dirname(__FILE__)
RSpec.configure do |config|
config.before(:suite) do
VIM = Vimrunner.start
VIM.add_plugin(File.expand_path('../..', __FILE__), 'plugin/scala.vim')
end
config.after(:suite) do
VIM.kill
end
end
def sort_fixture_across_groups(name)
fixture_path = "#{PWD}/fixtures/#{name}.scala"
temp_file = Tempfile.new('vim-scala-')
temp_file.write File.read(fixture_path)
temp_file.rewind
VIM.edit temp_file.path
VIM.command "let g:scala_sort_across_groups=1"
VIM.command "SortScalaImports"
VIM.write
temp_file.rewind
output = temp_file.read
temp_file.close
temp_file.unlink
output
end
def expected(name)
path = "#{PWD}/fixtures/#{name}.expected.scala"
File.read(path)
end