mirror of
https://github.com/amix/vimrc
synced 2025-07-09 10:45:00 +08:00
Cleaning deps.
This commit is contained in:
44
sources_non_forked/vim-ruby/spec/spec_helper.rb
Normal file
44
sources_non_forked/vim-ruby/spec/spec_helper.rb
Normal file
@ -0,0 +1,44 @@
|
||||
require 'tmpdir'
|
||||
require 'vimrunner'
|
||||
|
||||
module Support
|
||||
def assert_correct_indenting(string)
|
||||
whitespace = string.scan(/^\s*/).first
|
||||
string = string.split("\n").map { |line| line.gsub /^#{whitespace}/, '' }.join("\n").strip
|
||||
|
||||
File.open 'test.rb', 'w' do |f|
|
||||
f.write string
|
||||
end
|
||||
|
||||
@vim.edit 'test.rb'
|
||||
@vim.normal 'gg=G'
|
||||
@vim.write
|
||||
|
||||
IO.read('test.rb').strip.should eq string
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
include Support
|
||||
|
||||
config.before(:suite) do
|
||||
VIM = Vimrunner.start_gvim
|
||||
VIM.prepend_runtimepath(File.expand_path('../..', __FILE__))
|
||||
end
|
||||
|
||||
config.after(:suite) do
|
||||
VIM.kill
|
||||
end
|
||||
|
||||
config.around(:each) do |example|
|
||||
@vim = VIM
|
||||
|
||||
# cd into a temporary directory for every example.
|
||||
Dir.mktmpdir do |dir|
|
||||
Dir.chdir(dir) do
|
||||
@vim.command("cd #{dir}")
|
||||
example.call
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user