test/lightning_completion_test.rb in cldwalker-lightning-0.1.1 vs test/lightning_completion_test.rb in cldwalker-lightning-0.1.2
- old
+ new
@@ -1,23 +1,23 @@
require File.dirname(__FILE__) + '/test_helper'
class LightningCompletionTest < Test::Unit::TestCase
context "Completion" do
-
+ before(:each) {
+ @key = 'blah';
+ Lightning.bolts[@key].stub!(:completions, :return=>%w{at ap blah})
+ }
test "from script matches correctly" do
- Lightning.path_map.stub!(:completions, :return=>%w{at ap blah})
- assert_arrays_equal Lightning::Completion.complete('cd-test a', 'blah'), %w{at ap}
+ assert_arrays_equal Lightning::Completion.complete('cd-test a', @key), %w{at ap}
end
test "for basic case matches correctly" do
- Lightning.path_map.stub!(:completions, :return=>%w{at ap blah})
- @completion = Lightning::Completion.new('cd-test a', 'blah')
+ @completion = Lightning::Completion.new('cd-test a', @key)
assert_arrays_equal @completion.matches, %w{at ap}
end
test "with test flag matches correctly" do
- Lightning.path_map.stub!(:completions, :return=>%w{at ap blah})
- @completion = Lightning::Completion.new('cd-test -test a', 'blah')
+ @completion = Lightning::Completion.new('cd-test -test a', @key)
assert_arrays_equal @completion.matches, %w{at ap}
end
end
end