0
0
Fork 0

check, if the index dir has an index

This commit is contained in:
Gibheer 2011-05-09 15:32:58 +02:00
parent b771e23219
commit 99fa77b82b
3 changed files with 16 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# ignore test directories
spec/index_dir/*
# rcov generated
coverage

View File

@ -16,7 +16,7 @@ class Polecat
# returns true, if it has an index
def index_dir?
false
File.exists?(@path + '/index.txt')
end
def write term

View File

@ -29,7 +29,11 @@ describe "Index" do
i.index_dir?.should == false
end
it "returns true, if the directory contains an index"
it "returns true, if the directory contains an index" do
i = Polecat::Index.new @path
i.write 'foo'
i.index_dir?.should == true
end
end
describe "#write" do
@ -63,5 +67,12 @@ describe "Index" do
i.write "foo"
i.search("foo").should == 0
end
it "returns nil, when no match was found" do
i = Polecat::Index.new @path
i.write "foo"
i.write "bar"
i.search("baz").should == nil
end
end
end