lportal 1.0.18 → 1.0.19

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.
Files changed (64) hide show
  1. data/ChangeLog +5 -9
  2. data/Rakefile +12 -1
  3. data/db_connection.rb +9 -0
  4. data/lib/country.rb +5 -0
  5. data/lib/group.rb +2 -1
  6. data/lib/web/layout.rb +2 -3
  7. data/lportal.rb +8 -17
  8. data/rails_gem_chooser.rb +87 -0
  9. data/test/unit/account_test.rb +7 -4
  10. data/test/unit/address_test.rb +22 -1
  11. data/test/unit/announcement/delivery_test.rb +24 -0
  12. data/test/unit/announcement/entry_test.rb +4 -2
  13. data/test/unit/blog_post_test.rb +16 -4
  14. data/test/unit/bookmark/entry_test.rb +11 -2
  15. data/test/unit/bookmark/folder_test.rb +20 -2
  16. data/test/unit/calevent_test.rb +9 -2
  17. data/test/unit/company_test.rb +93 -29
  18. data/test/unit/contact_test.rb +12 -5
  19. data/test/unit/country_test.rb +25 -0
  20. data/test/unit/dl_file_test.rb +12 -6
  21. data/test/unit/dl_folder_test.rb +33 -4
  22. data/test/unit/emailaddress_test.rb +28 -0
  23. data/test/unit/group_test.rb +54 -27
  24. data/test/unit/ig/folder_test.rb +4 -2
  25. data/test/unit/ig/image_test.rb +10 -2
  26. data/test/unit/image_test.rb +12 -4
  27. data/test/unit/journal/article_image_test.rb +8 -6
  28. data/test/unit/journal/article_resource_test.rb +9 -5
  29. data/test/unit/journal/article_test.rb +24 -17
  30. data/test/unit/journal/feed_test.rb +31 -4
  31. data/test/unit/journal/structure_test.rb +31 -4
  32. data/test/unit/journal/template_test.rb +31 -4
  33. data/test/unit/mb/category_test.rb +44 -8
  34. data/test/unit/mb/discussion_test.rb +10 -5
  35. data/test/unit/mb/message_flag_test.rb +28 -0
  36. data/test/unit/mb/message_test.rb +22 -13
  37. data/test/unit/mb/stats_user_test.rb +28 -0
  38. data/test/unit/mb/thread_test.rb +10 -5
  39. data/test/unit/organization_test.rb +32 -8
  40. data/test/unit/permission_test.rb +45 -6
  41. data/test/unit/phone_test.rb +13 -7
  42. data/test/unit/poll/question_test.rb +30 -4
  43. data/test/unit/ratings_stats_test.rb +16 -0
  44. data/test/unit/release_test.rb +5 -3
  45. data/test/unit/resource_code_test.rb +5 -2
  46. data/test/unit/resource_test.rb +40 -19
  47. data/test/unit/role_test.rb +17 -9
  48. data/test/unit/social_activity_test.rb +35 -0
  49. data/test/unit/social_relation_test.rb +29 -0
  50. data/test/unit/tag/asset_test.rb +29 -15
  51. data/test/unit/tag/entry_test.rb +14 -4
  52. data/test/unit/tag/property_test.rb +14 -6
  53. data/test/unit/user_test.rb +86 -57
  54. data/test/unit/usergroup_test.rb +8 -5
  55. data/test/unit/web/layout_set_test.rb +21 -6
  56. data/test/unit/web/layout_test.rb +51 -20
  57. data/test/unit/web/portlet_preferences_test.rb +10 -2
  58. data/test/unit/web/portlet_properties_test.rb +10 -2
  59. data/test/unit/web/portlet_test.rb +12 -3
  60. data/test/unit/web/typesettings_test.rb +7 -3
  61. data/test/unit/wiki/node_test.rb +3 -2
  62. data/test/unit/wiki/page_test.rb +48 -2
  63. data/version.rb +1 -1
  64. metadata +186 -105
@@ -1,8 +1,35 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class Journal::FeedTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- def test_truth
6
- assert true
6
+ fixtures [
7
+ :Company,
8
+ :User_,
9
+ :Group_,
10
+ :JournalFeed
11
+ ]
12
+
13
+ def setup
14
+ @feeds = Journal::Feed.all
7
15
  end
16
+
17
+ def test_company
18
+ @feeds.each do |x|
19
+ assert_not_nil x.company
20
+ end
21
+ end
22
+
23
+ def test_group
24
+ @feeds.each do |x|
25
+ assert_not_nil x.group
26
+ end
27
+ end
28
+
29
+ def test_user
30
+ @feeds.each do |x|
31
+ assert_not_nil x.user
32
+ end
33
+ end
34
+
8
35
  end
@@ -1,8 +1,35 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class Journal::StructureTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- def test_truth
6
- assert true
6
+ fixtures [
7
+ :Company,
8
+ :User_,
9
+ :Group_,
10
+ :JournalStructure
11
+ ]
12
+
13
+ def setup
14
+ @strucs = Journal::Structure.all
7
15
  end
16
+
17
+ def test_company
18
+ @strucs.each do |x|
19
+ assert_not_nil x.company
20
+ end
21
+ end
22
+
23
+ def test_group
24
+ @strucs.each do |x|
25
+ assert_not_nil x.group
26
+ end
27
+ end
28
+
29
+ def test_user
30
+ @strucs.each do |x|
31
+ assert_not_nil x.user
32
+ end
33
+ end
34
+
8
35
  end
@@ -1,8 +1,35 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class Journal::TemplateTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- def test_truth
6
- assert true
6
+ fixtures [
7
+ :Company,
8
+ :User_,
9
+ :Group_,
10
+ :JournalTemplate
11
+ ]
12
+
13
+ def setup
14
+ @templates = Journal::Template.all
7
15
  end
16
+
17
+ def test_company
18
+ @templates.each do |x|
19
+ assert_not_nil x.company
20
+ end
21
+ end
22
+
23
+ def test_group
24
+ @templates.each do |x|
25
+ assert_not_nil x.group
26
+ end
27
+ end
28
+
29
+ def test_user
30
+ @templates.each do |x|
31
+ assert_not_nil x.user
32
+ end
33
+ end
34
+
8
35
  end
@@ -1,20 +1,25 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class MB::CategoryTest < ActiveSupport::TestCase
4
6
  fixtures [
5
- :mbcategory,
6
- :mbdiscussion,
7
- :mbmessage,
8
- :mbthread,
9
- :group_,
10
- :layout,
7
+ :Company,
8
+ :User_,
9
+ :Group_,
10
+ :MBCategory,
11
+ :MBDiscussion,
12
+ :MBMessage,
13
+ :MBThread,
14
+ :Layout,
15
+ :TagsAsset,
11
16
  :portletproperties
12
17
  ]
13
18
 
14
-
15
19
  def setup
16
20
  @categories = MB::Category.all
17
21
  flunk 'No categories to test' unless @categories.any?
22
+ @categories.delete(MB::Category.find(0))
18
23
  end
19
24
 
20
25
  def test_create
@@ -85,6 +90,15 @@ class MB::CategoryTest < ActiveSupport::TestCase
85
90
  end
86
91
  end
87
92
 
93
+ def test_messages
94
+ @categories.each do |x|
95
+ assert_not_nil x.messages
96
+ x.messages.each do |msg|
97
+ assert_equal x, msg.category
98
+ end
99
+ end
100
+ end
101
+
88
102
  def test_parent
89
103
  @categories.each do |x|
90
104
  unless x.parentcategoryid == 0 then
@@ -93,6 +107,28 @@ class MB::CategoryTest < ActiveSupport::TestCase
93
107
  end
94
108
  end
95
109
 
110
+ def test_asset
111
+ @categories.each do |x|
112
+ assert_not_nil x.asset
113
+ end
114
+ end
115
+
116
+ def test_subcategories
117
+ @categories.each do |x|
118
+ next if x.parentcategoryid==0
119
+ assert_not_nil x.subcategories
120
+ end
121
+ end
122
+
123
+ def test_threads
124
+ @categories.each do |x|
125
+ assert_not_nil x.threads
126
+ x.threads.each do |thrd|
127
+ assert_equal x, thrd.category
128
+ end
129
+ end
130
+ end
131
+
96
132
  def test_path
97
133
  @categories.each do |x|
98
134
  unless x.group
@@ -1,11 +1,16 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class MB::DiscussionTest < ActiveSupport::TestCase
4
6
  fixtures [
5
- :mbcategory,
6
- :mbdiscussion,
7
- :mbmessage,
8
- :mbthread
7
+ # :Company,
8
+ # :User_,
9
+ # :Group_,
10
+ :MBCategory,
11
+ :MBDiscussion,
12
+ :MBMessage,
13
+ :MBThread
9
14
  ]
10
15
 
11
16
  def setup
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
4
+
5
+ class MB::MessageFlagTest < ActiveSupport::TestCase
6
+ fixtures [
7
+ :User_,
8
+ :MBMessage,
9
+ :MBMessageFlag
10
+ ]
11
+
12
+ def setup
13
+ @flags = MB::MessageFlag.all
14
+ end
15
+
16
+ def test_user
17
+ @flags.each do |flag|
18
+ assert_not_nil flag.user
19
+ end
20
+ end
21
+
22
+ def test_message
23
+ @flags.each do |flag|
24
+ assert_not_nil flag.message
25
+ end
26
+ end
27
+
28
+ end
@@ -1,16 +1,19 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class MB::MessageTest < ActiveSupport::TestCase
4
6
  fixtures [
5
- :mbcategory,
6
- :mbdiscussion,
7
- :mbmessage,
8
- :mbthread,
9
- :mbstatsuser,
10
- :mbmessageflag,
11
- :classname_,
12
- :group_,
13
- :user_
7
+ :Company,
8
+ :User_,
9
+ :Group_,
10
+ :MBCategory,
11
+ :MBDiscussion,
12
+ :MBMessage,
13
+ :MBThread,
14
+ :MBStatsUser,
15
+ :MBMessageFlag,
16
+ :ClassName_
14
17
  ]
15
18
 
16
19
  def setup
@@ -91,7 +94,6 @@ class MB::MessageTest < ActiveSupport::TestCase
91
94
  assert_not_nil category
92
95
 
93
96
  user = User.first
94
- subject = random_string
95
97
  body = random_string
96
98
 
97
99
  thread = parent.thread
@@ -104,11 +106,10 @@ class MB::MessageTest < ActiveSupport::TestCase
104
106
  msg = MB::Message.create(
105
107
  :parent => parent,
106
108
  :user => user,
107
- :subject => subject,
108
109
  :body => body
109
110
  )
110
111
 
111
- assert_equal subject, msg.subject
112
+ assert_equal 're: %s' % parent.subject, msg.subject
112
113
  assert_equal body, msg.body
113
114
  assert_equal parent, msg.parent
114
115
 
@@ -188,6 +189,14 @@ class MB::MessageTest < ActiveSupport::TestCase
188
189
  end
189
190
  end
190
191
 
192
+ def test_flag
193
+ @messages.each do |x|
194
+ if x.flag
195
+ assert_equal MB::MessageFlag, x.flag.class
196
+ end
197
+ end
198
+ end
199
+
191
200
  def test_parent
192
201
  @messages.each do |x|
193
202
  unless x.parentmessageid == 0 then
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
4
+
5
+ class MB::StatsUserTest < ActiveSupport::TestCase
6
+ fixtures [
7
+ :User_,
8
+ :Group_,
9
+ :MBStatsUser
10
+ ]
11
+
12
+ def setup
13
+ @stats = MB::StatsUser.all
14
+ end
15
+
16
+ def test_user
17
+ @stats.each do |x|
18
+ assert_not_nil x.user
19
+ end
20
+ end
21
+
22
+ def test_group
23
+ @stats.each do |x|
24
+ assert_not_nil x.group
25
+ end
26
+ end
27
+
28
+ end
@@ -1,11 +1,16 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class MB::ThreadTest < ActiveSupport::TestCase
4
6
  fixtures [
5
- :mbcategory,
6
- :mbdiscussion,
7
- :mbmessage,
8
- :mbthread
7
+ # :Company,
8
+ # :User_,
9
+ # :Group_,
10
+ :MBCategory,
11
+ :MBDiscussion,
12
+ :MBMessage,
13
+ :MBThread
9
14
  ]
10
15
 
11
16
  def setup
@@ -1,14 +1,18 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  class OrganizationTest < ActiveSupport::TestCase
4
6
  fixtures [
5
- :company,
6
- :organization_,
7
- :user_,
8
- :users_orgs,
9
- :group_,
10
- :groups_orgs,
11
- :classname_
7
+ :Company,
8
+ :Group_,
9
+ :User_,
10
+ :Organization_,
11
+ :Groups_Orgs,
12
+ :Users_Groups,
13
+ :Users_Orgs,
14
+ :ClassName_,
15
+ :ListType
12
16
  ]
13
17
 
14
18
  def setup
@@ -23,7 +27,17 @@ class OrganizationTest < ActiveSupport::TestCase
23
27
  end
24
28
  end
25
29
 
30
+ def test_users
31
+ flunk mysql_bug if defined?(mysql_bug)
32
+
33
+ @orgs.each do |x|
34
+ assert_not_nil x.users
35
+ end
36
+ end
37
+
26
38
  def test_parent
39
+ flunk mysql_bug if defined?(mysql_bug)
40
+
27
41
  @orgs.each do |x|
28
42
  assert_not_nil x.parent unless x.parentorganizationid == 0
29
43
  end
@@ -34,6 +48,8 @@ class OrganizationTest < ActiveSupport::TestCase
34
48
  end
35
49
 
36
50
  def test_group
51
+ flunk mysql_bug if defined?(mysql_bug)
52
+
37
53
  @orgs.each do |x|
38
54
  group = x.hive
39
55
  assert_not_nil group, "#{x.id} does not have a personal group"
@@ -58,4 +74,12 @@ class OrganizationTest < ActiveSupport::TestCase
58
74
  end
59
75
  end
60
76
 
77
+ def test_status
78
+ flunk mysql_bug if defined?(mysql_bug)
79
+
80
+ @orgs.each do |x|
81
+ assert_not_nil x.status
82
+ end
83
+ end
84
+
61
85
  end
@@ -1,13 +1,18 @@
1
- require 'test_helper'
1
+ # encoding: utf-8
2
+
3
+ require 'test/test_helper'
2
4
 
3
5
  # this test is SLOW
4
6
  class PermissionTest < ActiveSupport::TestCase
5
7
  fixtures [
6
- :permission_,
7
- :role_,
8
- :roles_permissions,
9
- :users_permissions,
10
- :groups_permissions
8
+ :Company,
9
+ :Group_,
10
+ :User_,
11
+ :Permission_,
12
+ :Role_,
13
+ :Roles_Permissions,
14
+ :Users_Permissions,
15
+ :Groups_Permissions
11
16
  ]
12
17
 
13
18
  def setup
@@ -26,7 +31,41 @@ class PermissionTest < ActiveSupport::TestCase
26
31
  end
27
32
  end
28
33
 
34
+ def test_users
35
+ flunk mysql_bug if defined?(mysql_bug)
36
+
37
+ @permissions.each do |p|
38
+ assert_not_nil p.users
39
+ end
40
+ end
41
+
42
+ def test_roles
43
+ flunk mysql_bug if defined?(mysql_bug)
44
+
45
+ @permissions.each do |p|
46
+ assert_not_nil p.roles
47
+ end
48
+ end
49
+
50
+ def test_groups
51
+ flunk mysql_bug if defined?(mysql_bug)
52
+
53
+ @permissions.each do |p|
54
+ assert_not_nil p.groups
55
+ end
56
+ end
57
+
58
+ def test_holders
59
+ flunk mysql_bug if defined?(mysql_bug)
60
+
61
+ @permissions.each do |p|
62
+ assert_not_nil p.holders
63
+ end
64
+ end
65
+
29
66
  def test_rigidity
67
+ flunk mysql_bug if defined?(mysql_bug)
68
+
30
69
  # each role must exist!
31
70
  ActiveRecord::Base.connection.execute(
32
71
  "SELECT * from roles_permissions;"