History

Exclude docs without a db file from the manifest

Thibaut committed 11 years ago

Commit ca7ff601 parent ca61a2b2 files · +12 −2Browse files

Unified · Split

2 files
  1. lib/docs/core/manifest.rb +1 −1
  2. test/lib/docs/core/manifest_test.rb +11 −1
lib/docs/core/manifest.rb+1−1
@@ -27,7 +27,7 @@ module Docs · 26 unmodified lines
2727
2828 def indexed_docs
2929 @docs.select do |doc|
30− @store.exist? doc.index_path
30+ @store.exist?(doc.index_path) && @store.exist?(doc.db_path)
3131 end
3232 end
3333 end
test/lib/docs/core/manifest_test.rb+11−1
@@ -57,9 +57,10 @@ class ManifestTest < MiniTest::Spec · 56 unmodified lines
5757 assert_instance_of Array, manifest.as_json
5858 end
5959
60− context "when the doc has an index" do
60+ context "when the doc has an index and a db" do
6161 before do
6262 stub(store).exist?(index_path) { true }
63+ stub(store).exist?(db_path) { true }
6364 end
6465
6566 it "includes the doc's JSON representation" do
@@ -77,10 +78,19 @@ class ManifestTest < MiniTest::Spec · 11 unmodified lines
7778
7879 context "when the doc doesn't have an index" do
7980 it "doesn't include the doc" do
81+ stub(store).exist?(db_path) { true }
8082 stub(store).exist?(index_path) { false }
8183 assert_empty manifest.as_json
8284 end
8385 end
86+
87+ context "when the doc doesn't have a db" do
88+ it "doesn't include the doc" do
89+ stub(store).exist?(index_path) { true }
90+ stub(store).exist?(db_path) { false }
91+ assert_empty manifest.as_json
92+ end
93+ end
8494 end
8595
8696 describe "#to_json" do