1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
require "rspec"
require "clamp"
require 'stringio'
RSpec.configure do |config|
config.mock_with :rr
end
module OutputCapture
def self.included(target)
target.before do
$stdout = @out = StringIO.new
$stderr = @err = StringIO.new
end
target.after do
$stdout = STDOUT
$stderr = STDERR
end
end
def stdout
@out.string
end
def stderr
@err.string
end
end
module CommandFactory
def given_command(name, &block)
let(:command) do
Class.new(Clamp::Command, &block).new(name)
end
end
end
|