spec/lib/index/files_spec.rb in picky-0.11.2 vs spec/lib/index/files_spec.rb in picky-0.12.0

- old
+ new

@@ -1,33 +1,22 @@ require 'spec_helper' describe Index::Files do before(:each) do - @files_class = Index::Files - @files = @files_class.new :some_name, :some_category, :some_type + @index = stub :index, :name => :some_index + @category = stub :category, :name => :some_category + @configuration = Configuration::Index.new @index, @category - @prepared = @files.prepared + @files = Index::Files.new :some_name, @configuration - @index = @files.index - @similarity = @files.similarity - @weights = @files.weights + @prepared = @files.prepared + + @index = @files.index + @similarity = @files.similarity + @weights = @files.weights end - - describe 'create_directory' do - it 'should use makedirs to create the necessary directory structure' do - FileUtils.should_receive(:mkdir_p).once.with 'some/search/root/index/test/some_type' - - @files.create_directory - end - end - - describe 'cache_directory' do - it 'should be correct' do - @files.cache_directory.should == 'some/search/root/index/test/some_type' - end - end describe "retrieve" do it "delegates to the prepared" do @prepared.should_receive(:retrieve).once.with @@ -65,29 +54,29 @@ end describe "load_index" do it "uses the right file" do Yajl::Parser.stub! :parse - File.should_receive(:open).once.with 'some/search/root/index/test/some_type/some_name_some_category_index.json', 'r' + File.should_receive(:open).once.with 'some/search/root/index/test/some_index/some_category_some_name_index.json', 'r' @files.load_index end end describe "load_similarity" do it "uses the right file" do Marshal.stub! :load - File.should_receive(:open).once.with 'some/search/root/index/test/some_type/some_name_some_category_similarity.dump', 'r:binary' + File.should_receive(:open).once.with 'some/search/root/index/test/some_index/some_category_some_name_similarity.dump', 'r:binary' @files.load_similarity end end describe "load_weights" do it "uses the right file" do Yajl::Parser.stub! :parse - File.should_receive(:open).once.with 'some/search/root/index/test/some_type/some_name_some_category_weights.json', 'r' + File.should_receive(:open).once.with 'some/search/root/index/test/some_index/some_category_some_name_weights.json', 'r' @files.load_weights end end end @@ -167,20 +156,11 @@ @files.delete end end describe 'initialization' do - before(:each) do - @files = @files_class.new :some_name, :some_category, :some_type - end it 'should initialize the name correctly' do @files.bundle_name.should == :some_name - end - it 'should initialize the name correctly' do - @files.category_name.should == :some_category - end - it 'should initialize the name correctly' do - @files.type_name.should == :some_type end end end \ No newline at end of file