Sha256: 89e2a57628ba2ae5447fac81099b25fabf0041b61d45574b45cb314313d5372d
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'lib/load_path_find' $: << File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir1')) $: << File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir2')) describe 'load path find' do it "should find a file on the load path" do target = File.join('file1') $:.find_file(target)[-target.size, target.size].should == target end it "should find a directory on the load path" do target = File.join('..', 'dir1') $:.find_file(target)[-target.size, target.size].should == target end it "should find the first file when its ambigious" do target = File.join('file1') expected_target = File.join('dir1', 'file1') $:.find_file(target)[-expected_target.size, expected_target.size].should == expected_target end it "should find all files that match" do target = File.join('file1') expected_target = File.join('dir1', 'file1') $:.find_all_files(target).should == [ File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir1', 'file1')), File.expand_path(File.join(File.dirname(__FILE__), 'data', 'dir2', 'file1')) ] end it "should yield all files that match if a block is given" do target = File.join('file1') mock = Object.new mock.should_receive(:hello).exactly(2).times $:.find_all_files(target) { mock.hello } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
load_path_find-0.0.1 | spec/load_path_find_spec.rb |