Sha256: 57a4a195d2ea3301b4a593d51c8f2aa0b1eebd12244aaddcea8223450ab5ec7f
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class LightningTest < Test::Unit::TestCase context "Generator" do before(:all) do @config_file = File.dirname(__FILE__) + '/lightning_completions' Lightning.config[:generated_file] = @config_file Lightning::Generator.generate_completions end after(:all) { FileUtils.rm_f(Lightning.config[:generated_file]) } test "generates file in expected location" do assert File.exists?(@config_file) end #this depends on oa test "generates expected output for a command" do generated_command = <<-EOS.gsub(/^\s{6}/,'') #open mac applications oa () { if [ -z "$1" ]; then echo "No arguments given" return fi FULL_PATH="`${LBIN_PATH}lightning-full_path oa $@`" if [ $1 == '-test' ]; then CMD="open -a '$FULL_PATH'" echo $CMD else open -a "$FULL_PATH" fi } complete -o default -C "${LBIN_PATH}lightning-complete oa" oa EOS output = File.read(@config_file) assert output.include?(generated_command) end end context "Lightning" do test "complete() returns correctly for valid command" do Lightning::Completion.stub!(:complete, :return=>'blah') assert_equal 'blah', Lightning.complete('oa', 'blah') end test "complete() reports error for invalid command" do assert ! Lightning.complete('invalid','invalid').grep(/Error/).empty? end test "translate() returns errorless for valid command" do assert Lightning.translate('oa', 'blah').grep(/Error/).empty? end test "translate() reports error for invalid command" do assert ! Lightning.translate('invalid', 'blah').grep(/Error/).empty? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cldwalker-lightning-0.1.2 | test/lightning_test.rb |