Permalink
Browse files

Update vimrunner and ensure consistent buffer defaults

  • Loading branch information...
1 parent 76384e1 commit 934f15781095e367137794ddcadc79d7ae5ff3b3 @AndrewRadev AndrewRadev committed Oct 13, 2013
Showing with 18 additions and 33 deletions.
  1. +1 −1 Gemfile.lock
  2. +2 −2 spec/indent/blocks_spec.rb
  3. +15 −30 spec/spec_helper.rb
View
2 Gemfile.lock
@@ -10,7 +10,7 @@ GEM
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
- vimrunner (0.1.1)
+ vimrunner (0.3.0)
PLATFORMS
ruby
View
4 spec/indent/blocks_spec.rb
@@ -34,14 +34,14 @@ def foo
end
specify "case-insensitive matching" do
- @vim.set 'ignorecase'
+ vim.set 'ignorecase'
assert_correct_indenting <<-EOF
module X
Class.new do
end
end
EOF
- @vim.set 'ignorecase&'
+ vim.set 'ignorecase&'
end
specify "blocks with tuple arguments" do
View
45 spec/spec_helper.rb
@@ -1,7 +1,17 @@
-require 'tmpdir'
require 'vimrunner'
+require 'vimrunner/rspec'
+
+Vimrunner::RSpec.configure do |config|
+ config.reuse_server = true
+
+ config.start_vim do
+ vim = Vimrunner.start_gvim
+ vim.prepend_runtimepath(File.expand_path('../..', __FILE__))
+ vim.set 'expandtab'
+ vim.set 'shiftwidth', 2
+ vim
+ end
-module Support
def assert_correct_indenting(string)
whitespace = string.scan(/^\s*/).first
string = string.split("\n").map { |line| line.gsub /^#{whitespace}/, '' }.join("\n").strip
@@ -10,35 +20,10 @@ def assert_correct_indenting(string)
f.write string
end
- @vim.edit 'test.rb'
- @vim.normal 'gg=G'
- @vim.write
+ 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

0 comments on commit 934f157

Please sign in to comment.