Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

grrr, rspec + autotest is pain

  • Loading branch information...
commit 4d3ff1c6a494ba4e0b68edb0e78e7826f90f130e 1 parent 26b5a51
@igrigorik igrigorik authored
View
0  .rspec
No changes.
View
2  bin/vimgolf
@@ -3,7 +3,7 @@
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
-require 'vimgolf/cli'
+require 'vimgolf'
begin
VimGolf::CLI.start
View
5 lib/vimgolf.rb
@@ -1,3 +1,2 @@
-module Vimgolf
- # Your code goes here...
-end
+require 'thor'
+require 'vimgolf/cli'
View
2  lib/vimgolf/cli.rb
@@ -1,5 +1,3 @@
-require 'thor'
-
module VimGolf
class Error
end
View
17 spec/cli_spec.rb
@@ -0,0 +1,17 @@
+require "helper"
+
+describe VimGolf do
+ it "provides VimGolf errors" do
+ VimGolf::Error.should be
+ end
+
+ it "provides a help prompt" do
+ out = capture_stdout do
+ VimGolf::CLI.start(["help"])
+ end
+
+ out.should include("setup")
+ out.should include("launch")
+ end
+
+end
View
26 spec/helper.rb
@@ -0,0 +1,26 @@
+require 'rubygems'
+require 'bundler/setup'
+
+require 'rspec'
+require 'lib/vimgolf'
+
+
+module Kernel
+ def capture_stdio(input = nil, &block)
+ require 'stringio'
+ org_stdin, $stdin = $stdin, StringIO.new(input) if input
+ org_stdout, $stdout = $stdout, StringIO.new
+ yield
+ return @out = $stdout.string
+ ensure
+ $stdout = org_stdout
+ $stdin = org_stdin
+ end
+ alias capture_stdout capture_stdio
+end
+
+RSpec.configure do |config|
+ # config.include RSpec::Helpers
+ # config.include RSpec::GitRepo
+ # config.extend RSpec::Helpers::SemanticNames
+end
View
4 vimgolf.gemspec
@@ -13,7 +13,9 @@ Gem::Specification.new do |s|
s.description = s.summary
s.rubyforge_project = "vimgolf"
- s.add_dependency = "thor"
+ s.add_dependency "thor"
+
+ s.add_development_dependency "rspec"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Please sign in to comment.
Something went wrong with that request. Please try again.