diff options
| -rw-r--r-- | spec/Gemfile | 4 | ||||
| -rw-r--r-- | spec/Gemfile.lock | 20 | ||||
| -rw-r--r-- | spec/spec/loading_spec.rb | 14 | ||||
| -rwxr-xr-x | spec/spec/spec_helper.rb | 23 | 
4 files changed, 61 insertions, 0 deletions
| diff --git a/spec/Gemfile b/spec/Gemfile new file mode 100644 index 00000000..4a544814 --- /dev/null +++ b/spec/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'vimrunner' +gem 'rspec' diff --git a/spec/Gemfile.lock b/spec/Gemfile.lock new file mode 100644 index 00000000..f88e86d1 --- /dev/null +++ b/spec/Gemfile.lock @@ -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 diff --git a/spec/spec/loading_spec.rb b/spec/spec/loading_spec.rb new file mode 100644 index 00000000..459f0720 --- /dev/null +++ b/spec/spec/loading_spec.rb @@ -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 diff --git a/spec/spec/spec_helper.rb b/spec/spec/spec_helper.rb new file mode 100755 index 00000000..b9205d27 --- /dev/null +++ b/spec/spec/spec_helper.rb @@ -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 | 
