require 'repertoire/compat' require 'spec_helper' describe Compat do it "should have a list of directories that contain programs" do Compat.paths.any? { |dir| File.directory?(dir) }.should == true end it "should be able to find programs" do File.executable?(Compat.find_program('dir')).should == true end it "should be able to run programs" do Compat.sh('dir').should_not == false end it "should raise ProgramNotFound when running missing programs" do lambda { Compat.sh('obviously_not_there') }.should raise_error(ProgramNotFound) end it "should raise CommandFailed when the program fails" do lambda { Compat.sh('dir','obviously_missing_dir') }.should raise_error(CommandFailed) end end