Sha256: a3531692d2d8cc36c8f89dd466ae46844679bdde4e1c3098e1fa34672e31bbfb
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe "Alf's alf command / " do Dir[_('command/**/*.cmd', __FILE__)].each do |input| cmd = wlang(File.readlines(input).first, binding) specify{ cmd.should =~ /^alf / } describe "#{File.basename(input)}: #{cmd}" do let(:argv) { Quickl.parse_commandline_args(cmd)[1..-1] } let(:stdout) { File.join(File.dirname(input), "#{File.basename(input, ".cmd")}.stdout") } let(:stderr) { File.join(File.dirname(input), "#{File.basename(input, ".cmd")}.stderr") } let(:stdout_expected) { File.exists?(stdout) ? wlang(File.read(stdout), binding) : "" } let(:stderr_expected) { File.exists?(stderr) ? wlang(File.read(stderr), binding) : "" } before{ $oldstdout = $stdout $oldstderr = $stderr $stdout = StringIO.new $stderr = StringIO.new } after { $stdout = $oldstdout $stderr = $oldstderr $oldstdout = nil $oldstderr = nil } specify{ begin dir = File.expand_path('../__database__', __FILE__) main = Alf::Command::Main.new main.environment = Alf::Environment.folder(dir) main.run(argv, __FILE__) rescue => ex begin Alf::Command::Main.handle_error(ex, main) rescue SystemExit $stdout << "SystemExit" << "\n" end end $stdout.string.should(eq(stdout_expected)) unless RUBY_VERSION < "1.9" $stderr.string.should(eq(stderr_expected)) unless RUBY_VERSION < "1.9" } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alf-0.10.1 | spec/integration/test_command.rb |
alf-0.10.0 | spec/integration/test_command.rb |