| author | Tomas Zeman <tzeman@volny.cz> |
| Tue, 03 Apr 2012 14:39:58 +0200 | |
| changeset 35 | d77d8194ee59 |
| parent 31 | 0b74e7bbe6ff |
| permissions | -rw-r--r-- |
| 8 | 1 |
/* |
2 |
* Copyright 2011 Tomas Zeman <tzeman@volny.cz> |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
16 |
package fis.crm.model |
|
17 |
||
18 |
import fis.base.model._ |
|
19 |
import net.liftweb.common._ |
|
20 |
import net.liftweb.util._ |
|
21 |
import net.liftweb.util.Helpers._ |
|
22 |
import org.scalatest._ |
|
23 |
||
|
23
16066379860c
Global entity removal from base schema
Tomas Zeman <tzeman@volny.cz>
parents:
8
diff
changeset
|
24 |
class ContactSpec extends AbstractTest with BeforeAndAfterAll {
|
| 8 | 25 |
|
26 |
override def beforeAll() {
|
|
27 |
super.beforeAll |
|
28 |
doInDB { schema.dropAndCreate }
|
|
29 |
} |
|
30 |
||
31 |
"EntityContact" should "create" in { doInDB {
|
|
32 |
val c1 = Contact.createRecord.name("c1")
|
|
| 35 | 33 |
ContactCrud.save(c1) should be ('defined)
|
| 31 | 34 |
/* |
| 8 | 35 |
val t1 = CodeListItem.createRecord.name("t1")
|
36 |
codeListItems.insert(t1) |
|
| 31 | 37 |
*/ |
| 8 | 38 |
val c2 = Contact.createRecord.name("c2") // acts here as entity
|
| 35 | 39 |
ContactCrud.save(c2) should be ('defined)
|
|
23
16066379860c
Global entity removal from base schema
Tomas Zeman <tzeman@volny.cz>
parents:
8
diff
changeset
|
40 |
/* |
| 8 | 41 |
entityContacts.insert(EntityContact(c2.id, c1.id, t1.id)) |
42 |
||
43 |
val el1 = c1.entities.toList |
|
44 |
el1.size should equal (1) |
|
45 |
el1.head.id should equal (c2.id) |
|
46 |
el1.head.name.get should equal ("c2")
|
|
47 |
val al1 = c1.entities.associations.toList |
|
48 |
al1.size should equal (1) |
|
49 |
al1.head.contactType.one should equal (Some(t1)) |
|
|
23
16066379860c
Global entity removal from base schema
Tomas Zeman <tzeman@volny.cz>
parents:
8
diff
changeset
|
50 |
*/ |
| 8 | 51 |
}} |
52 |
||
53 |
object schema extends CrmSchema with DropAndCreate |
|
54 |
||
55 |
} |
|
56 |
||
57 |
// vim: set ts=2 sw=2 et: |