· 7 years ago · Jan 13, 2019, 04:34 AM
1Anorm BadPath error
2[BadPath: path parameter: Invalid path ' - could not find datasource for default': Token not allowed in path expression: '-' (you can double-quote this token if you really want it here)]
3
4DB.withConnection { implicit c =>
5
6Create Table IF NOT EXISTS SegmentCategories(
7 id bigint(20) NOT NULL AUTO_INCREMENT,
8 name varchar(255) NOT NULL,
9 PRIMARY KEY (id)
10);
11
12insert into SegmentCategories (name) values ('Restaurants');
13insert into SegmentCategories (name) values ('Hotels');
14
15evolutions/
16 default/
17 test/
18
19db.default.driver=${?cloud.services.default-db.connection.driver}
20db.default.url=${?cloud.services.default-db.connection.url}
21db.default.user=${?cloud.services.default-db.connection.username}
22db.default.password=${?cloud.services.default-db.connection.password}
23db.test.driver=org.h2.Driver
24db.test.url="jdbc:h2:mem:play"
25
26"be listed" in {
27 running(FakeApplication(additionalConfiguration = inMemoryDatabase("test"))) {
28
29 val segmentCategories = SegmentCategoryModel.list()
30
31 segmentCategories.total must equalTo(2)
32 segmentCategories.items must have length(2)
33
34 }
35 }