Sha256: efe2cbbac112e7995f1043e399a18ecdaa556a6f16f9b2c9ec0ade65586632cb

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 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)     { Alf::Tools::parse_commandline_args(cmd)[1..-1] }
      let(:stdout)   { File.join(File.dirname(input), "#{File.basename(input, ".cmd")}.stdout") }
      let(:expected) { wlang(File.read(stdout), binding) }

      before{ 
        $oldstdout = $stdout 
        $stdout = StringIO.new
      }
      after { 
        $stdout = $oldstdout
        $oldstdout = 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 SystemExit
          $stdout << SystemExit << "\n"
        end
        $stdout.string.should(eq(expected)) unless RUBY_VERSION < "1.9"
      }
    end
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.9.3 spec/integration/test_command.rb