History

Add Doc#db_path

Thibaut committed 11 years ago

Commit ca61a2b1 parent 5c46eab4 files · +21 −4Browse files

Showing the changes to test (2 of 4 files). Show all

Unified · Split

2 files
  1. test/lib/docs/core/doc_test.rb +9 −2
  2. test/lib/docs/core/manifest_test.rb +5 −0
test/lib/docs/core/doc_test.rb+9−2
@@ -87,6 +87,13 @@ class DocsDocTest < MiniTest::Spec · 86 unmodified lines
87 end87 end
88 end88 end
89 89
90 describe ".db_path" do
91 it "returns .path + ::DB_FILENAME" do
92 stub(doc).path { 'path' }
93 assert_equal File.join('path', Docs::Doc::DB_FILENAME), doc.db_path
94 end
95 end
96
90 describe ".new" do97 describe ".new" do
91 it "raises an error when .abstract is true" do98 it "raises an error when .abstract is true" do
92 doc.abstract = true99 doc.abstract = true
@@ -101,8 +108,8 @@ class DocsDocTest < MiniTest::Spec · 8 unmodified lines
101 assert_instance_of Hash, doc.as_json108 assert_instance_of Hash, doc.as_json
102 end109 end
103 110
104 it "includes the doc's name, slug, type, version and index_path" do111 it "includes the doc's name, slug, type, version, index_path and db_path" do
105 %w(name slug type version index_path).each do |attribute|112 %w(name slug type version index_path db_path).each do |attribute|
106 eval "stub(doc).#{attribute} { attribute }"113 eval "stub(doc).#{attribute} { attribute }"
107 assert_equal attribute, doc.as_json[attribute.to_sym]114 assert_equal attribute, doc.as_json[attribute.to_sym]
108 end115 end
test/lib/docs/core/manifest_test.rb+5−0
@@ -43,8 +43,13 @@ class ManifestTest < MiniTest::Spec · 42 unmodified lines
43 'index_path'43 'index_path'
44 end44 end
45 45
46 let :db_path do
47 'db_path'
48 end
49
46 before do50 before do
47 stub(doc).index_path { index_path }51 stub(doc).index_path { index_path }
52 stub(doc).db_path { db_path }
48 end53 end
49 54
50 it "returns an array" do55 it "returns an array" do