lportal 1.0.0 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -2
- data/init.rb +4 -0
- data/lib/announcement/entry.rb +17 -0
- data/lib/blog_post.rb +3 -0
- data/lib/bookmark/entry.rb +22 -0
- data/lib/bookmark/folder.rb +18 -0
- data/lib/calevent.rb +20 -0
- data/lib/classname.rb +78 -0
- data/lib/company.rb +5 -0
- data/lib/ig/folder.rb +11 -0
- data/lib/ig/image.rb +3 -4
- data/lib/journal/article_resource.rb +6 -2
- data/lib/mb/message.rb +0 -3
- data/lib/mb/thread.rb +5 -1
- data/lib/organization.rb +9 -2
- data/lib/resource.rb +5 -11
- data/lib/tag/asset.rb +40 -1
- data/lib/user.rb +7 -0
- data/lib/usergroup.rb +4 -4
- data/lib/web/layout.rb +4 -0
- data/lib/web/layout_set.rb +14 -10
- data/lib/web/portlet.rb +9 -9
- data/lib/web/portlet_preferences.rb +6 -6
- data/lib/wiki/page.rb +3 -0
- data/lportal.rb +12 -1
- data/test/unit/account_test.rb +5 -2
- data/test/unit/address_test.rb +0 -4
- data/test/unit/announcement/entry_test.rb +28 -0
- data/test/unit/blog_post_test.rb +38 -0
- data/test/unit/bookmark/entry_test.rb +28 -0
- data/test/unit/bookmark/folder_test.rb +22 -0
- data/test/unit/calevent_test.rb +28 -0
- data/test/unit/company_test.rb +31 -18
- data/test/unit/contact_test.rb +6 -5
- data/test/unit/group_test.rb +4 -2
- data/test/unit/ig/folder_test.rb +23 -3
- data/test/unit/ig/image_test.rb +11 -3
- data/test/unit/journal/article_image_test.rb +6 -5
- data/test/unit/journal/article_resource_test.rb +16 -3
- data/test/unit/journal/article_test.rb +19 -6
- data/test/unit/mb/category_test.rb +21 -5
- data/test/unit/mb/discussion_test.rb +9 -2
- data/test/unit/mb/message_test.rb +16 -8
- data/test/unit/mb/thread_test.rb +10 -3
- data/test/unit/organization_test.rb +20 -21
- data/test/unit/permission_test.rb +30 -9
- data/test/unit/resource_code_test.rb +8 -4
- data/test/unit/resource_test.rb +46 -24
- data/test/unit/role_test.rb +5 -3
- data/test/unit/tag/asset_test.rb +61 -0
- data/test/unit/tag/entry_test.rb +17 -7
- data/test/unit/tag/property_test.rb +12 -4
- data/test/unit/user_test.rb +37 -44
- data/test/unit/usergroup_test.rb +10 -9
- data/test/unit/web/layout_set_test.rb +38 -34
- data/test/unit/web/layout_test.rb +3 -5
- data/test/unit/web/portlet_preferences_test.rb +10 -6
- data/test/unit/web/portlet_test.rb +14 -8
- data/test/unit/wiki/node_test.rb +1 -4
- data/test/unit/wiki/page_test.rb +1 -4
- data/version.rb +4 -0
- metadata +28 -10
- data/lib/announcement.rb +0 -5
- data/lib/bookmark.rb +0 -10
- data/lib/web/portlet_name.rb +0 -6
- data/test/unit/announcement_test.rb +0 -8
- data/test/unit/asset_test.rb +0 -29
- data/test/unit/bookmark_test.rb +0 -8
- data/test/unit/user_group_test.rb +0 -8
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class AssetTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:tagsasset,
|
6
|
+
:resource_, :resourcecode,
|
7
|
+
:blogsentry
|
8
|
+
]
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@posts = BlogPost.all
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_user
|
15
|
+
@posts.each do |p|
|
16
|
+
assert_not_nil p.user
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_group
|
21
|
+
@posts.each do |p|
|
22
|
+
assert_not_nil p.group
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_asset
|
27
|
+
@posts.each do |p|
|
28
|
+
assert_not_nil p.asset
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# def test_resource
|
33
|
+
# @posts.each do |p|
|
34
|
+
# assert_not_nil p.resource
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Bookmark::EntryTest < ActiveSupport::TestCase
|
4
|
+
fixtures :bookmarksentry, :bookmarksfolder
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@bookmarks = Bookmark::Entry.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_company
|
11
|
+
@bookmarks.each do |x|
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_user
|
17
|
+
@bookmarks.each do |x|
|
18
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_folder
|
23
|
+
@bookmarks.each do |x|
|
24
|
+
assert_not_nil x.folder
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Bookmark::FolderTest < ActiveSupport::TestCase
|
4
|
+
fixtures :bookmarksentry, :bookmarksfolder
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@folders = Bookmark::Folder.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_company
|
11
|
+
@folders.each do |x|
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_user
|
17
|
+
@folders.each do |x|
|
18
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CaleventTest < ActiveSupport::TestCase
|
4
|
+
fixtures :calevent
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@events = Calevent.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_company
|
11
|
+
@events.each do |x|
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_user
|
17
|
+
@events.each do |x|
|
18
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_group
|
23
|
+
@events.each do |x|
|
24
|
+
assert_not_nil x.group
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/test/unit/company_test.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CompanyTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
fixtures [
|
5
|
+
:account_, :organization_, :contact_,
|
6
|
+
:layout, :layoutset,
|
7
|
+
:resource_, :resourcecode
|
8
|
+
]
|
9
|
+
|
8
10
|
|
9
11
|
# each company must have an account
|
10
12
|
def test_account
|
@@ -21,40 +23,51 @@ class CompanyTest < ActiveSupport::TestCase
|
|
21
23
|
end
|
22
24
|
|
23
25
|
# hmm?
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
# def test_defaultuser
|
27
|
+
# @companies.each do |c|
|
28
|
+
# assert c.account.user.is_default?, "No default user for #{c.id}"
|
29
|
+
# assert c.account.user.is_active?, "Default user account for #{c.id} is not active"
|
30
|
+
# assert c.account.user.company == c, "Default user for #{c.id} has wrong company"
|
31
|
+
# assert !c.account.user.account.nil?, "Default user for #{c.id} has no account"
|
32
|
+
# end
|
33
|
+
# end
|
32
34
|
|
33
35
|
# each company must have a webid
|
34
36
|
def test_webid
|
35
37
|
@companies.each do |c|
|
36
|
-
|
38
|
+
assert_not_nil c.webid, "#{c.id} has no webid"
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
# each company must have a virtualhost
|
41
43
|
def test_virtualhost
|
44
|
+
layoutsets_virtualhosts=Web::LayoutSet.find(:all).map{|s| s.virtualhost }
|
42
45
|
@companies.each do |c|
|
43
|
-
|
46
|
+
assert_not_nil c.virtualhost, "#{c.id} has no virtualhost"
|
47
|
+
|
48
|
+
# check that the virtualhost isn't duplicated in any layoutsets
|
49
|
+
assert !layoutsets_virtualhosts.include?(c.virtualhost), "Duplicate virtualhost #{c.virtualhost} in layoutsets"
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
47
53
|
# each company must have organization(s)
|
48
|
-
def
|
54
|
+
def test_organizations
|
49
55
|
@companies.each do |c|
|
50
56
|
assert !c.organizations.empty?, "#{c.id} has no organizations"
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
54
|
-
def
|
55
|
-
@companies.each do |
|
56
|
-
assert !
|
60
|
+
def test_administrators
|
61
|
+
@companies.each do |c|
|
62
|
+
assert !c.administrators.empty?, "#{c.id} has no administrators"
|
57
63
|
end
|
58
64
|
end
|
59
65
|
|
66
|
+
# ?
|
67
|
+
# def test_resource
|
68
|
+
# @companies.each do |x|
|
69
|
+
# assert !x.resource.nil?, "#{x.id} has no resource"
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
|
60
73
|
end
|
data/test/unit/contact_test.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class ContactTest < ActiveSupport::TestCase
|
4
|
-
|
4
|
+
fixtures :contact_, :account_
|
5
|
+
|
5
6
|
def setup
|
6
|
-
@contacts = Contact.
|
7
|
+
@contacts = Contact.all
|
7
8
|
assert !@contacts.empty?, "No contacts found"
|
8
9
|
end
|
9
10
|
|
10
11
|
# each company must have an account
|
11
12
|
def test_account
|
12
13
|
@contacts.each do |c|
|
13
|
-
|
14
|
+
assert_not_nil c.account, "#{c} has no account"
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
17
18
|
def test_user
|
18
|
-
@contacts.each do |
|
19
|
-
|
19
|
+
@contacts.each do |c|
|
20
|
+
assert_not_nil c.user, "#{c} has no user"
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
data/test/unit/group_test.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class GroupTest < ActiveSupport::TestCase
|
4
|
+
fixtures :organization_
|
5
|
+
|
4
6
|
def setup
|
5
7
|
@groups = Group.find :all
|
6
8
|
assert !@groups.empty?, "No groups"
|
@@ -48,7 +50,7 @@ class GroupTest < ActiveSupport::TestCase
|
|
48
50
|
# each group must belong to a creator
|
49
51
|
def test_creator
|
50
52
|
@groups.each do |x|
|
51
|
-
|
53
|
+
# assert !x.creator.nil?, "#{x.id} has no creator"
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -69,7 +71,7 @@ class GroupTest < ActiveSupport::TestCase
|
|
69
71
|
|
70
72
|
def test_resource
|
71
73
|
@groups.each do |x|
|
72
|
-
|
74
|
+
# assert !x.resource.nil?, "#{x.id} has no resource"
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
data/test/unit/ig/folder_test.rb
CHANGED
@@ -1,8 +1,28 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class IG::FolderTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
fixtures :igimage, :igfolder
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@folders = IG::Folder.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_company
|
11
|
+
@folders.each do |x|
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_user
|
17
|
+
@folders.each do |x|
|
18
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_group
|
23
|
+
@folders.each do |x|
|
24
|
+
assert_not_nil x.group
|
25
|
+
end
|
7
26
|
end
|
27
|
+
|
8
28
|
end
|
data/test/unit/ig/image_test.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class IG::ImageTest < ActiveSupport::TestCase
|
4
|
+
fixtures :igimage, :igfolder
|
5
|
+
|
4
6
|
def setup
|
5
|
-
@igimages = IG::Image.
|
7
|
+
@igimages = IG::Image.all
|
6
8
|
end
|
7
9
|
|
8
10
|
def test_company
|
9
11
|
@igimages.each do |x|
|
10
|
-
|
12
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_user
|
15
17
|
@igimages.each do |x|
|
16
|
-
|
18
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_folder
|
23
|
+
@igimages.each do |x|
|
24
|
+
assert_not_nil x.folder
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
@@ -1,20 +1,33 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class Journal::ArticleResourceTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:journalarticle,
|
6
|
+
:journalarticleresource,
|
7
|
+
:tagsasset
|
8
|
+
]
|
9
|
+
|
4
10
|
def setup
|
5
|
-
@resources = Journal::ArticleResource.
|
11
|
+
@resources = Journal::ArticleResource.all
|
6
12
|
end
|
7
13
|
|
8
14
|
def test_group
|
9
15
|
@resources.each do |x|
|
10
|
-
|
16
|
+
assert_not_nil x.group, "#{x.id} belongs to no group!"
|
11
17
|
end
|
12
18
|
end
|
13
19
|
|
14
20
|
def test_article
|
15
21
|
@resources.each do |x|
|
16
|
-
|
22
|
+
assert_not_nil x.article, "#{x.id} has no article!"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_asset
|
27
|
+
@resources.each do |x|
|
28
|
+
assert_not_nil x.asset, "#{x.id} has no asset!"
|
17
29
|
end
|
18
30
|
end
|
19
31
|
|
32
|
+
|
20
33
|
end
|
@@ -1,39 +1,52 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class Journal::ArticleTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:journalarticle,
|
6
|
+
:journalarticleresource,
|
7
|
+
:tagsasset
|
8
|
+
]
|
9
|
+
|
4
10
|
def setup
|
5
|
-
@articles = Journal::Article.
|
11
|
+
@articles = Journal::Article.all
|
6
12
|
end
|
7
13
|
|
8
14
|
# each article must belong to a company
|
9
15
|
def test_company
|
10
16
|
@articles.each do |x|
|
11
|
-
|
17
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
12
18
|
end
|
13
19
|
end
|
14
20
|
|
15
21
|
def test_group
|
16
22
|
@articles.each do |x|
|
17
|
-
|
23
|
+
assert_not_nil x.group, "#{x.id} belongs to no group!"
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
21
27
|
def test_owner
|
22
28
|
@articles.each do |x|
|
23
|
-
|
29
|
+
assert_not_nil x.owner, "#{x.id} belongs to no user!"
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
27
33
|
def test_articleid
|
28
34
|
@articles.each do |x|
|
29
|
-
|
35
|
+
assert_not_nil x.articleid, "#{x.id} has no articleid!"
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
33
39
|
def test_resource
|
34
40
|
@articles.each do |x|
|
35
|
-
|
41
|
+
assert_not_nil x.resource, "#{x.id} belongs to no resource"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_asset
|
46
|
+
@articles.each do |x|
|
47
|
+
assert_not_nil x.asset, "#{x.id} has no asset!"
|
36
48
|
end
|
37
49
|
end
|
38
50
|
|
51
|
+
|
39
52
|
end
|
@@ -1,35 +1,51 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class MB::CategoryTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:mbcategory,
|
6
|
+
:mbdiscussion,
|
7
|
+
:mbmessage,
|
8
|
+
:mbthread
|
9
|
+
]
|
10
|
+
|
4
11
|
def setup
|
5
|
-
@categories = MB::Category.
|
12
|
+
@categories = MB::Category.all
|
13
|
+
@rootcategory = MB::Category.find 0
|
14
|
+
@categories.delete @rootcategory
|
6
15
|
end
|
7
16
|
|
8
17
|
# each article must belong to a company
|
9
18
|
def test_company
|
10
19
|
@categories.each do |x|
|
11
|
-
|
20
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
12
21
|
end
|
13
22
|
end
|
14
23
|
|
15
24
|
def test_group
|
16
25
|
@categories.each do |x|
|
17
|
-
|
26
|
+
assert_not_nil x.group, "#{x.id} belongs to no group!"
|
18
27
|
end
|
19
28
|
end
|
20
29
|
|
21
30
|
def test_user
|
22
31
|
@categories.each do |x|
|
23
|
-
|
32
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
24
33
|
end
|
25
34
|
end
|
26
35
|
|
27
36
|
def test_parent
|
28
37
|
@categories.each do |x|
|
29
38
|
unless x.parentcategoryid == 0 then
|
30
|
-
|
39
|
+
assert_not_nil x.parent, "#{x.id} refers to parent category #{x.parentcategoryid} which does not exist"
|
31
40
|
end
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
44
|
+
def test_root
|
45
|
+
assert_equal 0, @rootcategory.companyid
|
46
|
+
assert_equal 0, @rootcategory.groupid
|
47
|
+
assert_equal 0, @rootcategory.userid
|
48
|
+
assert_equal 0, @rootcategory.parentcategoryid
|
49
|
+
end
|
50
|
+
|
35
51
|
end
|
@@ -1,13 +1,20 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class MB::DiscussionTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:mbcategory,
|
6
|
+
:mbdiscussion,
|
7
|
+
:mbmessage,
|
8
|
+
:mbthread
|
9
|
+
]
|
10
|
+
|
4
11
|
def setup
|
5
|
-
@discussions = MB::Discussion.
|
12
|
+
@discussions = MB::Discussion.all
|
6
13
|
end
|
7
14
|
|
8
15
|
def test_thread
|
9
16
|
@discussions.each do |x|
|
10
|
-
|
17
|
+
assert_not_nil x.thread, "#{x.id} belongs to no thread"
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
@@ -1,31 +1,38 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class MB::MessageTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:mbcategory,
|
6
|
+
:mbdiscussion,
|
7
|
+
:mbmessage,
|
8
|
+
:mbthread
|
9
|
+
]
|
10
|
+
|
4
11
|
def setup
|
5
|
-
@messages = MB::Message.
|
12
|
+
@messages = MB::Message.all
|
6
13
|
end
|
7
14
|
|
8
15
|
def test_company
|
9
16
|
@messages.each do |x|
|
10
|
-
|
17
|
+
assert_not_nil x.company, "#{x.id} belongs to no company"
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
21
|
def test_user
|
15
22
|
@messages.each do |x|
|
16
|
-
|
23
|
+
assert_not_nil x.user, "#{x.id} belongs to no user!"
|
17
24
|
end
|
18
25
|
end
|
19
26
|
|
20
27
|
def test_category
|
21
28
|
@messages.each do |x|
|
22
|
-
|
29
|
+
assert_not_nil x.category, "#{x.id} belongs to no category!"
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
26
33
|
def test_thread
|
27
34
|
@messages.each do |x|
|
28
|
-
|
35
|
+
assert_not_nil x.thread, "#{x.id} belongs to no thread"
|
29
36
|
if x.parentmessageid == 0 then
|
30
37
|
assert x.thread.rootmessageid == x.id, "Discrepancy between thread #{x.thread.id} rootmessageid #{x.thread.rootmessageid} and message #{x.id}"
|
31
38
|
end
|
@@ -35,10 +42,11 @@ class MB::MessageTest < ActiveSupport::TestCase
|
|
35
42
|
def test_parent
|
36
43
|
@messages.each do |x|
|
37
44
|
unless x.parentmessageid == 0 then
|
38
|
-
|
45
|
+
assert_not_nil x.parent, "#{x.id} refers to parent message #{x.parentmessageid} which does not exist"
|
39
46
|
else
|
40
|
-
# there must be a thread with this message
|
41
|
-
assert MB::Thread.find(:all).map{
|
47
|
+
# there must be a root thread with this message
|
48
|
+
assert MB::Thread.find(:all).map{
|
49
|
+
|t| t.rootmessageid }.include?(x.id), "Message #{x.id} appears not to belong to any thread"
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
data/test/unit/mb/thread_test.rb
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class MB::ThreadTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:mbcategory,
|
6
|
+
:mbdiscussion,
|
7
|
+
:mbmessage,
|
8
|
+
:mbthread
|
9
|
+
]
|
10
|
+
|
4
11
|
def setup
|
5
|
-
@threads = MB::Thread.
|
12
|
+
@threads = MB::Thread.all
|
6
13
|
end
|
7
14
|
|
8
15
|
def test_category
|
9
16
|
@threads.each do |x|
|
10
|
-
|
17
|
+
assert_not_nil x.category, "#{x.id} belongs to no category"
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
21
|
def test_root
|
15
22
|
@threads.each do |x|
|
16
|
-
|
23
|
+
assert_not_nil x.root, "#{x.id} has no root message"
|
17
24
|
end
|
18
25
|
end
|
19
26
|
|
@@ -1,34 +1,41 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class OrganizationTest < ActiveSupport::TestCase
|
4
|
+
fixtures [
|
5
|
+
:organization_, :groups_orgs,
|
6
|
+
:classname_
|
7
|
+
]
|
8
|
+
|
4
9
|
def setup
|
5
|
-
@orgs = Organization.
|
10
|
+
@orgs = Organization.all
|
6
11
|
assert !@orgs.empty?
|
7
12
|
end
|
8
13
|
|
9
14
|
# each organization must belong to a company
|
10
15
|
def test_company
|
11
16
|
@orgs.each do |x|
|
12
|
-
|
17
|
+
assert_not_nil x.company
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# end
|
21
|
+
def test_parent
|
22
|
+
@orgs.each do |x|
|
23
|
+
assert_not_nil x.parent unless x.parentorganizationid == 0
|
24
|
+
end
|
25
|
+
end
|
22
26
|
|
27
|
+
def test_root
|
28
|
+
assert_not_nil Organization.find_by_parentorganizationid(0), 'No root organization'
|
29
|
+
end
|
23
30
|
|
24
|
-
|
25
|
-
def test_hive
|
31
|
+
def test_group
|
26
32
|
@orgs.each do |x|
|
27
33
|
group = x.hive
|
28
|
-
|
34
|
+
assert_not_nil group, "#{x.id} does not have a personal group"
|
29
35
|
|
30
|
-
|
31
|
-
|
36
|
+
_class = Classname.find_by_value x.liferay_class
|
37
|
+
assert_not_nil _class
|
38
|
+
assert_equal _class.id, group.classnameid, "#{x.id}'s personal group is not assigned to #{x.liferay_class}"
|
32
39
|
|
33
40
|
assert group.is_active?, "#{x.id}'s personal group is not active"
|
34
41
|
|
@@ -37,14 +44,6 @@ class OrganizationTest < ActiveSupport::TestCase
|
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
40
|
-
|
41
|
-
def test_group
|
42
|
-
@orgs.each do |x|
|
43
|
-
|
44
|
-
assert !Group.find(:all, :conditions => "classnameid=10017 AND classpk=#{x.id}").empty?, "No group found with classnameid 10017 and classpk #{x.id}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
47
|
# each member have to belong to the same company than the organization
|
49
48
|
def test_members_companies
|
50
49
|
@orgs.each do |org|
|