spec/finders_spec.rb in data_paths-0.2.1 vs spec/finders_spec.rb in data_paths-0.3.0.rc1

- old
+ new

@@ -1,38 +1,41 @@ -require 'data_paths/finders' - require 'spec_helper' require 'helpers/data' +require 'data_paths/finders' + describe DataPaths::Finders do - before(:all) do - @example = DataClass.new + subject do + Class.new { + include DataPaths + include DataPaths::Finders + }.new end it "should find a file" do - @example.find_data_file('one.txt').should == File.join(Helpers::DATA_DIRS[0],'one.txt') + subject.find_data_file('one.txt').should == File.join(Helpers::DATA_DIRS[0],'one.txt') end it "should find a directory" do - @example.find_data_dir('dir').should == File.join(Helpers::DATA_DIRS[0],'dir') + subject.find_data_dir('dir').should == File.join(Helpers::DATA_DIRS[0],'dir') end it "should find all matching files" do - @example.all_data_files('dir/two.txt').should == [ + subject.all_data_files('dir/two.txt').should == [ File.join(Helpers::DATA_DIRS[0],'dir','two.txt'), File.join(Helpers::DATA_DIRS[1],'dir','two.txt') ] end it "should find all matching directories" do - @example.all_data_dirs('dir').should == [ + subject.all_data_dirs('dir').should == [ File.join(Helpers::DATA_DIRS[0],'dir'), File.join(Helpers::DATA_DIRS[1],'dir') ] end it "should find all paths matching a pattern" do - @example.data_glob('*/*.txt').should == [ + subject.glob_data_paths('*/*.txt').should == [ File.join(Helpers::DATA_DIRS[0],'dir','two.txt'), File.join(Helpers::DATA_DIRS[1],'dir','two.txt') ] end end