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
27 27
28 def indexed_docs28 def indexed_docs
29 @docs.select do |doc|29 @docs.select do |doc|
30 @store.exist? doc.index_path30 @store.exist?(doc.index_path) && @store.exist?(doc.db_path)
31 end31 end
32 end32 end
33 end33 end
test/lib/docs/core/manifest_test.rb+11−1
@@ -57,9 +57,10 @@ class ManifestTest < MiniTest::Spec · 56 unmodified lines
57 assert_instance_of Array, manifest.as_json57 assert_instance_of Array, manifest.as_json
58 end58 end
59 59
60 context "when the doc has an index" do60 context "when the doc has an index and a db" do
61 before do61 before do
62 stub(store).exist?(index_path) { true }62 stub(store).exist?(index_path) { true }
63 stub(store).exist?(db_path) { true }
63 end64 end
64 65
65 it "includes the doc's JSON representation" do66 it "includes the doc's JSON representation" do
@@ -77,10 +78,19 @@ class ManifestTest < MiniTest::Spec · 11 unmodified lines
77 78
78 context "when the doc doesn't have an index" do79 context "when the doc doesn't have an index" do
79 it "doesn't include the doc" do80 it "doesn't include the doc" do
81 stub(store).exist?(db_path) { true }
80 stub(store).exist?(index_path) { false }82 stub(store).exist?(index_path) { false }
81 assert_empty manifest.as_json83 assert_empty manifest.as_json
82 end84 end
83 end85 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
84 end94 end
85 95
86 describe "#to_json" do96 describe "#to_json" do