check, if the index dir has an index
This commit is contained in:
parent
b771e23219
commit
99fa77b82b
|
@ -1,3 +1,6 @@
|
|||
# ignore test directories
|
||||
spec/index_dir/*
|
||||
|
||||
# rcov generated
|
||||
coverage
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue