typus 3.0.11 → 3.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -1
- data/app/helpers/admin/relationships_helper.rb +2 -2
- data/app/views/admin/dashboard/_applications.html.erb +1 -1
- data/app/views/admin/helpers/resources/_errors.html.erb +1 -1
- data/app/views/admin/helpers/sidebar/_sidebar.html.erb +1 -1
- data/app/views/admin/resources/index.html.erb +2 -2
- data/app/views/admin/templates/_has_n.html.erb +1 -1
- data/app/views/admin/templates/_has_one.html.erb +1 -1
- data/config/locales/typus.ca.yml +1 -1
- data/config/locales/typus.de.models.yml +6 -5
- data/config/locales/typus.de.yml +39 -36
- data/config/locales/typus.el.yml +1 -1
- data/config/locales/typus.es.yml +1 -1
- data/config/locales/typus.fr.yml +1 -1
- data/config/locales/typus.hu.yml +1 -1
- data/config/locales/typus.locale.yml.template +1 -1
- data/config/locales/typus.pt-BR.yml +1 -1
- data/config/locales/typus.pt-PT.yml +1 -1
- data/config/locales/typus.ru.yml +1 -1
- data/config/locales/typus.zh-CN.yml +1 -1
- data/lib/typus/version.rb +1 -1
- data/typus.gemspec +7 -4
- metadata +16 -164
- data/test/app/controllers/admin/account_controller_test.rb +0 -106
- data/test/app/controllers/admin/assets_controller_test.rb +0 -156
- data/test/app/controllers/admin/base_controller_test.rb +0 -41
- data/test/app/controllers/admin/birds_controller_test.rb +0 -42
- data/test/app/controllers/admin/cases_controller_test.rb +0 -21
- data/test/app/controllers/admin/categories_controller_test.rb +0 -134
- data/test/app/controllers/admin/comments_controller_test.rb +0 -79
- data/test/app/controllers/admin/dashboard_controller_test.rb +0 -162
- data/test/app/controllers/admin/image_holders_controller_test.rb +0 -75
- data/test/app/controllers/admin/invoices_controller_test.rb +0 -78
- data/test/app/controllers/admin/orders_controller_test.rb +0 -18
- data/test/app/controllers/admin/pages_controller_test.rb +0 -37
- data/test/app/controllers/admin/posts_controller_test.rb +0 -770
- data/test/app/controllers/admin/projects_controller_test.rb +0 -52
- data/test/app/controllers/admin/session_controller_test.rb +0 -92
- data/test/app/controllers/admin/status_controller_test.rb +0 -54
- data/test/app/controllers/admin/typus_users_controller_test.rb +0 -156
- data/test/app/controllers/admin/users_controller_test.rb +0 -106
- data/test/app/controllers/admin/views_controller_test.rb +0 -36
- data/test/app/helpers/admin/base_helper_test.rb +0 -83
- data/test/app/helpers/admin/dashboard_helper_test.rb +0 -32
- data/test/app/helpers/admin/file_preview_helper_test.rb +0 -90
- data/test/app/helpers/admin/filters_helper_test.rb +0 -166
- data/test/app/helpers/admin/form_helper_test.rb +0 -126
- data/test/app/helpers/admin/list_helper_test.rb +0 -76
- data/test/app/helpers/admin/relationships_helper_test.rb +0 -19
- data/test/app/helpers/admin/resources_helper_test.rb +0 -46
- data/test/app/helpers/admin/search_helper_test.rb +0 -60
- data/test/app/helpers/admin/sidebar_helper_test.rb +0 -34
- data/test/app/helpers/admin/table_helper_test.rb +0 -241
- data/test/app/mailers/admin/mailer_test.rb +0 -32
- data/test/app/models/admin_user_test.rb +0 -5
- data/test/app/models/typus_user_roles_test.rb +0 -125
- data/test/app/models/typus_user_test.rb +0 -228
- data/test/config/routes_test.rb +0 -29
- data/test/factories.rb +0 -122
- data/test/fixtures/config/broken/application.yml +0 -68
- data/test/fixtures/config/broken/application_roles.yml +0 -20
- data/test/fixtures/config/broken/empty.yml +0 -0
- data/test/fixtures/config/broken/empty_roles.yml +0 -0
- data/test/fixtures/config/broken/undefined.yml +0 -3
- data/test/fixtures/config/broken/undefined_roles.yml +0 -6
- data/test/fixtures/config/default/typus.yml +0 -13
- data/test/fixtures/config/default/typus_roles.yml +0 -2
- data/test/fixtures/config/empty/empty_01.yml +0 -0
- data/test/fixtures/config/empty/empty_01_roles.yml +0 -0
- data/test/fixtures/config/empty/empty_02.yml +0 -0
- data/test/fixtures/config/empty/empty_02_roles.yml +0 -0
- data/test/fixtures/config/locales/es.yml +0 -10
- data/test/fixtures/config/namespaced/application.yml +0 -5
- data/test/fixtures/config/namespaced/application_roles.yml +0 -2
- data/test/fixtures/config/ordered/001_roles.yml +0 -2
- data/test/fixtures/config/ordered/002_roles.yml +0 -2
- data/test/fixtures/config/unordered/app_one_roles.yml +0 -2
- data/test/fixtures/config/unordered/app_two_roles.yml +0 -2
- data/test/lib/support/active_record_test.rb +0 -174
- data/test/lib/support/fake_user_test.rb +0 -63
- data/test/lib/support/hash_test.rb +0 -29
- data/test/lib/support/object_test.rb +0 -17
- data/test/lib/support/string_test.rb +0 -98
- data/test/lib/typus/configuration_test.rb +0 -46
- data/test/lib/typus/controller/actions_test.rb +0 -141
- data/test/lib/typus/controller/associations_test.rb +0 -7
- data/test/lib/typus/controller/autocomplete_test.rb +0 -7
- data/test/lib/typus/controller/filters_test.rb +0 -73
- data/test/lib/typus/controller/format_test.rb +0 -7
- data/test/lib/typus/i18n_test.rb +0 -9
- data/test/lib/typus/orm/active_record/class_methods_test.rb +0 -390
- data/test/lib/typus/orm/active_record/search_test.rb +0 -330
- data/test/lib/typus/regex_test.rb +0 -53
- data/test/lib/typus/resources_test.rb +0 -41
- data/test/lib/typus_test.rb +0 -142
- data/test/test_helper.rb +0 -15
@@ -1,68 +0,0 @@
|
|
1
|
-
Page:
|
2
|
-
fields:
|
3
|
-
# Body field is overrided from a Page class method.
|
4
|
-
list: title, body, status
|
5
|
-
form: title, body, status
|
6
|
-
relationships:
|
7
|
-
has_many: assets
|
8
|
-
application: Site
|
9
|
-
|
10
|
-
Asset:
|
11
|
-
fields:
|
12
|
-
list: caption
|
13
|
-
form: caption
|
14
|
-
application: Site
|
15
|
-
|
16
|
-
Category:
|
17
|
-
fields:
|
18
|
-
list: name, position
|
19
|
-
form: name, permalink, position
|
20
|
-
order_by: position
|
21
|
-
module: Post
|
22
|
-
|
23
|
-
Post:
|
24
|
-
fields:
|
25
|
-
list: title, created_at, status
|
26
|
-
form: title, body, created_at, status
|
27
|
-
relationship: title, created_at
|
28
|
-
options:
|
29
|
-
selectors: status
|
30
|
-
read_only: permalink
|
31
|
-
auto_generated: created_at
|
32
|
-
date_formats:
|
33
|
-
created_at: short
|
34
|
-
relationships: assets, categories
|
35
|
-
actions:
|
36
|
-
index: cleanup
|
37
|
-
edit: send_as_newsletter, preview
|
38
|
-
filters: status, created_at, user, user_id
|
39
|
-
search: title
|
40
|
-
order_by: title, -created_at
|
41
|
-
application: Blog
|
42
|
-
|
43
|
-
User:
|
44
|
-
fields:
|
45
|
-
list: first_name, last_name, email
|
46
|
-
|
47
|
-
Comment:
|
48
|
-
fields:
|
49
|
-
list: email, post, post_id
|
50
|
-
form: email, post
|
51
|
-
filters: post
|
52
|
-
search: email, body
|
53
|
-
application: Blog
|
54
|
-
|
55
|
-
TypusUser:
|
56
|
-
fields:
|
57
|
-
list: first_name, last_name, email, role, status
|
58
|
-
form: first_name, last_name, email, role, password, password_confirmation
|
59
|
-
relationship: first_name, last_name, role, email, status
|
60
|
-
options:
|
61
|
-
selectors: role
|
62
|
-
booleans:
|
63
|
-
status: active, inactive
|
64
|
-
filters: status, role, unexisting
|
65
|
-
search: first_name, last_name, email, role
|
66
|
-
module: Typus
|
67
|
-
description: System Users Administration
|
68
|
-
application: Typus
|
@@ -1,20 +0,0 @@
|
|
1
|
-
admin:
|
2
|
-
Asset: create, read, update, delete
|
3
|
-
Category: create, read, update, delete
|
4
|
-
Comment: create, read, update, delete
|
5
|
-
TypusUser: create, read, update, delete
|
6
|
-
Page: create, read, update, delete
|
7
|
-
Post: create, read, update, delete
|
8
|
-
Status: index
|
9
|
-
Order:
|
10
|
-
|
11
|
-
editor:
|
12
|
-
Category: create, read, update
|
13
|
-
Comment: read, update, delete
|
14
|
-
Post: create, read, update
|
15
|
-
TypusUser: read, update
|
16
|
-
|
17
|
-
designer:
|
18
|
-
Category: read, update
|
19
|
-
Comment: read
|
20
|
-
Post: read
|
File without changes
|
File without changes
|
@@ -1,13 +0,0 @@
|
|
1
|
-
TypusUser:
|
2
|
-
fields:
|
3
|
-
default: first_name, last_name, role, email
|
4
|
-
list: email, role, status
|
5
|
-
form: first_name, last_name, role, email, password, password_confirmation
|
6
|
-
options:
|
7
|
-
selectors: role
|
8
|
-
booleans:
|
9
|
-
status: Active, Inactive
|
10
|
-
filters: status, role
|
11
|
-
search: first_name, last_name, email, role
|
12
|
-
application: Typus
|
13
|
-
description: System Users Administration
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,174 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ActiveRecordTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
context "relationship_with" do
|
6
|
-
|
7
|
-
should "return relationship between Post and Comment" do
|
8
|
-
assert_equal :has_many, Post.relationship_with(Comment)
|
9
|
-
end
|
10
|
-
|
11
|
-
should "return relationship between Comment and Post" do
|
12
|
-
assert_equal :belongs_to, Comment.relationship_with(Post)
|
13
|
-
end
|
14
|
-
|
15
|
-
should "return relationship between Post and Category" do
|
16
|
-
assert_equal :has_and_belongs_to_many, Post.relationship_with(Category)
|
17
|
-
end
|
18
|
-
|
19
|
-
should "return relationship between Category and Post" do
|
20
|
-
assert_equal :has_and_belongs_to_many, Category.relationship_with(Post)
|
21
|
-
end
|
22
|
-
|
23
|
-
should "return relationship between Order and Invoice" do
|
24
|
-
assert_equal :has_one, Order.relationship_with(Invoice)
|
25
|
-
end
|
26
|
-
|
27
|
-
should "return relationship between Invoice and Order" do
|
28
|
-
assert_equal :belongs_to, Invoice.relationship_with(Order)
|
29
|
-
end
|
30
|
-
|
31
|
-
should "return relationship between Invoice and TypusUser" do
|
32
|
-
assert_equal :belongs_to, Invoice.relationship_with(TypusUser)
|
33
|
-
end
|
34
|
-
|
35
|
-
should "return relationship between TypusUser and Invoice" do
|
36
|
-
assert_equal :has_many, TypusUser.relationship_with(Invoice)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
context "mapping" do
|
42
|
-
|
43
|
-
teardown do
|
44
|
-
Post.send(:remove_const, :STATUS)
|
45
|
-
Post::STATUS = { "Draft" => "draft",
|
46
|
-
"Published" => "published",
|
47
|
-
"Unpublished" => "unpublished",
|
48
|
-
"<div class=''>Something special</div>".html_safe => "special" }
|
49
|
-
end
|
50
|
-
|
51
|
-
context "with an array" do
|
52
|
-
|
53
|
-
setup do
|
54
|
-
Post.send(:remove_const, :STATUS)
|
55
|
-
Post::STATUS = %w(pending published unpublished)
|
56
|
-
end
|
57
|
-
|
58
|
-
should "work for symbols" do
|
59
|
-
post = Factory(:post)
|
60
|
-
assert_equal "published", post.mapping(:status)
|
61
|
-
end
|
62
|
-
|
63
|
-
should "work for strings" do
|
64
|
-
post = Factory(:post, :status => "unpublished")
|
65
|
-
assert_equal "unpublished", post.mapping('status')
|
66
|
-
end
|
67
|
-
|
68
|
-
should "for unexisting keys returning the current key" do
|
69
|
-
post = Factory(:post, :status => "unexisting")
|
70
|
-
assert_equal "unexisting", post.mapping(:status)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
context "with a two dimension array" do
|
76
|
-
|
77
|
-
setup do
|
78
|
-
Post.send(:remove_const, :STATUS)
|
79
|
-
Post::STATUS = [["Publicado", "published"],
|
80
|
-
["Pendiente", "pending"],
|
81
|
-
["No publicado", "unpublished"]]
|
82
|
-
end
|
83
|
-
|
84
|
-
should "verify" do
|
85
|
-
post = Factory(:post)
|
86
|
-
assert_equal "Publicado", post.mapping(:status)
|
87
|
-
post = Factory(:post, :status => "unpublished")
|
88
|
-
assert_equal "No publicado", post.mapping(:status)
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
context "with a hash" do
|
94
|
-
|
95
|
-
setup do
|
96
|
-
Post.send(:remove_const, :STATUS)
|
97
|
-
Post::STATUS = { "Pending - Hash" => "pending",
|
98
|
-
"Published - Hash" => "published",
|
99
|
-
"Not Published - Hash" => "unpublished" }
|
100
|
-
end
|
101
|
-
|
102
|
-
should "verify" do
|
103
|
-
page = Factory(:post)
|
104
|
-
assert_equal "Published - Hash", page.mapping(:status)
|
105
|
-
page = Factory(:post, :status => "unpublished")
|
106
|
-
assert_equal "Not Published - Hash", page.mapping(:status)
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
context "to_label" do
|
114
|
-
|
115
|
-
should "return email for TypusUser" do
|
116
|
-
typus_user = Factory(:typus_user)
|
117
|
-
assert_equal typus_user.email, typus_user.to_label
|
118
|
-
end
|
119
|
-
|
120
|
-
should "return name for Category" do
|
121
|
-
category = Factory(:category, :name => "Chunky Bacon")
|
122
|
-
assert_match "Chunky Bacon", category.to_label
|
123
|
-
end
|
124
|
-
|
125
|
-
should "return Model#id because Category#name is empty" do
|
126
|
-
category = Factory(:category)
|
127
|
-
category.name = nil
|
128
|
-
category.save(:validate => false)
|
129
|
-
assert_equal "Category##{category.id}", category.to_label
|
130
|
-
end
|
131
|
-
|
132
|
-
should "return default Model#id" do
|
133
|
-
assert_match /Post#/, Factory(:post).to_label
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
context "to_resource" do
|
139
|
-
|
140
|
-
should "work for models" do
|
141
|
-
assert_equal "typus_users", TypusUser.to_resource
|
142
|
-
end
|
143
|
-
|
144
|
-
should "work for namespaced models" do
|
145
|
-
assert_equal "delayed/tasks", Delayed::Task.to_resource
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|
149
|
-
|
150
|
-
context "namespaced?" do
|
151
|
-
|
152
|
-
should "return true if namespaced" do
|
153
|
-
assert Delayed::Task.namespaced?
|
154
|
-
end
|
155
|
-
|
156
|
-
should "return false if no namespaced" do
|
157
|
-
assert !Entry.namespaced?
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
context "namespace" do
|
163
|
-
|
164
|
-
should "return the namespace" do
|
165
|
-
assert_equal "Delayed", Delayed::Task.namespace
|
166
|
-
end
|
167
|
-
|
168
|
-
should "not return the namespace" do
|
169
|
-
assert Entry.namespace.nil?
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class FakeUserTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@fake_user = FakeUser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
should "have the id set to 0" do
|
10
|
-
assert_equal 0, @fake_user.id
|
11
|
-
end
|
12
|
-
|
13
|
-
should "be able to do anything" do
|
14
|
-
assert @fake_user.can?("sing")
|
15
|
-
assert !@fake_user.cannot?("sing")
|
16
|
-
end
|
17
|
-
|
18
|
-
should "have a locale" do
|
19
|
-
assert_equal ::I18n.locale, @fake_user.locale
|
20
|
-
end
|
21
|
-
|
22
|
-
should "have status set to true" do
|
23
|
-
assert @fake_user.status
|
24
|
-
end
|
25
|
-
|
26
|
-
should "be considered as root" do
|
27
|
-
assert @fake_user.is_root?
|
28
|
-
end
|
29
|
-
|
30
|
-
should "not be considered as no_root" do
|
31
|
-
assert !@fake_user.is_not_root?
|
32
|
-
end
|
33
|
-
|
34
|
-
should "have access to all applications" do
|
35
|
-
assert_equal Typus.applications, @fake_user.applications
|
36
|
-
end
|
37
|
-
|
38
|
-
context "application" do
|
39
|
-
|
40
|
-
should "have access to all applications filtered" do
|
41
|
-
assert_equal Typus.application("CRUD"), @fake_user.application("CRUD")
|
42
|
-
end
|
43
|
-
|
44
|
-
should "make sure I get what I want" do
|
45
|
-
expected = ["Animal", "Bird", "Dog", "ImageHolder"]
|
46
|
-
assert_equal expected, @fake_user.application("Polymorphic")
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
should "be master_role" do
|
52
|
-
assert_equal Typus.master_role, @fake_user.role
|
53
|
-
end
|
54
|
-
|
55
|
-
should "not respond to resources" do
|
56
|
-
assert !@fake_user.respond_to?(:resources)
|
57
|
-
end
|
58
|
-
|
59
|
-
should "always be the owner of a resource" do
|
60
|
-
assert @fake_user.owns?('a')
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class HashTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
should "verify Hash#compact" do
|
6
|
-
hash = { "a" => "", "b" => nil, "c" => "hello" }
|
7
|
-
hash_compacted = { "c" => "hello" }
|
8
|
-
assert_equal hash_compacted, hash.compact
|
9
|
-
end
|
10
|
-
|
11
|
-
context "cleanup" do
|
12
|
-
|
13
|
-
should "work" do
|
14
|
-
whitelist = %w(controller action id input layout resource resource_id resource_action selected back_to )
|
15
|
-
whitelist.each do |w|
|
16
|
-
expected = { w => w }
|
17
|
-
assert_equal expected, expected.dup.cleanup
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
should "reject unwanted stuff" do
|
22
|
-
hash = {"attribute" => "dragonfly"}
|
23
|
-
expected = {}
|
24
|
-
assert_equal expected, hash.cleanup
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|