test/mango_index_test.rb in dolly-3.1.4 vs test/mango_index_test.rb in dolly-3.1.5
- old
+ new
@@ -19,18 +19,37 @@
stub_request(:get, index_base_path).
to_return(body: { indexes:[ {
ddoc: nil,
name:"_all_docs",
type:"special",
- def:{ fields:[{ _id:"asc" }] }
+ def:{ fields:[{ _id: "asc" }] }
},
{
ddoc: "_design/1",
name:"foo-index-json",
type:"json",
def:{ fields:[{ foo:"asc" }] }
}
]}.to_json)
+ end
+
+ test '#create_in_database' do
+ assert_equal "Migrations for design_skipped skiped.", Dolly::MangoIndex.create_in_database(
+ :design_skipped,
+ "demo",
+ [:_id]
+ )
+ end
+
+ test '#create_in_database' do
+ stub_request(:post, "http://localhost:5984/test/_index").
+ to_return(status: 200, body: "Design doc run", headers: {})
+
+ assert_equal "Design doc run", Dolly::MangoIndex.create_in_database(
+ :default,
+ "demo",
+ [:_id]
+ )
end
test '#delete_all' do
previous_indexes = Dolly::MangoIndex.all