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
|
# rcov generated
|
||||||
coverage
|
coverage
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Polecat
|
||||||
|
|
||||||
# returns true, if it has an index
|
# returns true, if it has an index
|
||||||
def index_dir?
|
def index_dir?
|
||||||
false
|
File.exists?(@path + '/index.txt')
|
||||||
end
|
end
|
||||||
|
|
||||||
def write term
|
def write term
|
||||||
|
|
|
@ -29,7 +29,11 @@ describe "Index" do
|
||||||
i.index_dir?.should == false
|
i.index_dir?.should == false
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "#write" do
|
describe "#write" do
|
||||||
|
@ -63,5 +67,12 @@ describe "Index" do
|
||||||
i.write "foo"
|
i.write "foo"
|
||||||
i.search("foo").should == 0
|
i.search("foo").should == 0
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue