Add specs to be sure all plugins are loading properly

This commit is contained in:
Adam Stankiewicz 2013-09-14 20:09:32 +02:00
parent 17149b4657
commit 77f091c8c7
4 changed files with 61 additions and 0 deletions

4
spec/Gemfile Normal file
View File

@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'vimrunner'
gem 'rspec'

20
spec/Gemfile.lock Normal file
View File

@ -0,0 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.1.3)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
vimrunner (0.3.0)
PLATFORMS
ruby
DEPENDENCIES
rspec
vimrunner

14
spec/spec/loading_spec.rb Normal file
View File

@ -0,0 +1,14 @@
require 'spec_helper'
describe "My Vim plugin" do
languages = Dir["#{PLUGIN_PATH}/syntax/*.vim"].map { |f| f.split('/').last.gsub('.vim', '') }
languages.each do |lang|
it "should parse .#{lang} file" do
write_file "test.#{lang}", ""
vim.edit "test.#{lang}"
vim.insert "sample"
vim.write
end
end
end

23
spec/spec/spec_helper.rb Executable file
View File

@ -0,0 +1,23 @@
require 'vimrunner'
require 'vimrunner/rspec'
PLUGIN_PATH = File.expand_path('../../..', __FILE__)
puts PLUGIN_PATH
Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
# instance per test (slower, but can be easier to manage).
config.reuse_server = true
# Decide how to start a Vim instance. In this block, an instance should be
# spawned and set up with anything project-specific.
config.start_vim do
vim = Vimrunner.start
# Setup your plugin in the Vim instance
vim.add_plugin(PLUGIN_PATH)
# The returned value is the Client available in the tests.
vim
end
end