require "spec_helper"
require "vimrunner"
require "vimrunner/errors"

module Vimrunner
  describe NoSuitableVimError do
    it "has a useful message" do
      expect {
        raise NoSuitableVimError
      }.to raise_error(/No suitable Vim executable could be found for this system./)
    end
  end

  describe TimeoutError do
    it "has a useful message" do
      expect {
        raise TimeoutError
      }.to raise_error(/Timed out while waiting for serverlist. Is an X11 server running?/)
    end
  end

  describe InvalidCommandError do
    it "has a useful message" do
      expect {
        Vimrunner.start do |vim|
          vim.command :nonexistent
        end
      }.to raise_error(/Not an editor command: nonexistent/)
    end
  end
end

require "spec_helper"
require "vimrunner/errors"

module Vimrunner
  describe NoSuitableVimError do
    it "has a useful message" do
      expect {
        raise NoSuitableVimError
      }.to raise_error("No suitable Vim executable could be found for this system.")
    end
  end

  describe TimeoutError do
    it "has a useful message" do
      expect {
        raise TimeoutError
      }.to raise_error("Timed out while waiting for serverlist. Is an X11 server running?")
    end
  end
end

--- 
+++ 
@@ -1,4 +1,5 @@
 require "spec_helper"
+require "vimrunner"
 require "vimrunner/errors"
 
 module Vimrunner
@@ -6,7 +7,7 @@
     it "has a useful message" do
       expect {
         raise NoSuitableVimError
-      }.to raise_error("No suitable Vim executable could be found for this system.")
+      }.to raise_error(/No suitable Vim executable could be found for this system./)
     end
   end
 
@@ -14,7 +15,17 @@
     it "has a useful message" do
       expect {
         raise TimeoutError
-      }.to raise_error("Timed out while waiting for serverlist. Is an X11 server running?")
+      }.to raise_error(/Timed out while waiting for serverlist. Is an X11 server running?/)
+    end
+  end
+
+  describe InvalidCommandError do
+    it "has a useful message" do
+      expect {
+        Vimrunner.start do |vim|
+          vim.command :nonexistent
+        end
+      }.to raise_error(/Not an editor command: nonexistent/)
     end
   end
 end
Add a spec for InvalidCommandError
