robot-vim 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ module RobotVim
34
34
  private
35
35
 
36
36
  def invoke_vim(script_file_path, input_file)
37
- Kernel.send(:`, "#{self.vim_binary} -N -n -u #{self.vimrc} -s #{script_file_path} #{input_file}")
37
+ Kernel.send(:`, "#{self.vim_binary} -N -n -u #{self.vimrc} -s #{script_file_path} #{input_file} 2>/dev/null")
38
38
  end
39
39
 
40
40
  def output_write_command(output_file_name)
@@ -1,5 +1,5 @@
1
1
  module Robot
2
2
  module Vim
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,4 @@
1
+ function! AskMeSomething()
2
+ let response = input('What do you want?: ')
3
+ call setline('.', response)
4
+ endfunction
@@ -46,4 +46,21 @@ describe "Automating Vim with RobotVim" do
46
46
  end
47
47
  end
48
48
 
49
+ describe "running commands that take user input" do
50
+ it "can run fake user input" do
51
+ input = "I am going to be replaced by the user's input"
52
+
53
+ commands = <<-COMMANDS
54
+ :call AskMeSomething()
55
+ yes please
56
+ COMMANDS
57
+
58
+ vimrc = File.join(File.dirname(__FILE__), "fixtures", "vimrc_with_user_input")
59
+ runner = RobotVim::Runner.new(:vimrc => vimrc)
60
+ result = runner.run(:commands => commands, :input_file => input)
61
+ result.should == "yes please" + "\n"
62
+ end
63
+
64
+ end
65
+
49
66
  end
@@ -51,7 +51,12 @@ describe RobotVim::Runner do
51
51
  end
52
52
 
53
53
  it "runs against the requested input file" do
54
- Kernel.should_receive(:`).with(/#{input_file}$/)
54
+ Kernel.should_receive(:`).with(/#{input_file}/)
55
+ run_robot
56
+ end
57
+
58
+ it "redirects stderr so we don't see Vim warnings about not outputting to a terminal" do
59
+ Kernel.should_receive(:`).with(/2>\/dev\/null/)
55
60
  run_robot
56
61
  end
57
62
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: robot-vim
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Margolis
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-28 00:00:00 -05:00
13
+ date: 2011-05-20 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -83,6 +83,7 @@ files:
83
83
  - robot-vim.gemspec
84
84
  - spec/fixtures/unsorted_file.txt
85
85
  - spec/fixtures/vimrc_with_not_to_gross
86
+ - spec/fixtures/vimrc_with_user_input
86
87
  - spec/integration_spec.rb
87
88
  - spec/robot-vim/file_name_generator_spec.rb
88
89
  - spec/robot-vim/input_file_spec.rb