anoubis 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/anoubis/application_controller.rb +18 -6
- data/app/controllers/anoubis/core/application_controller.rb +6 -6
- data/app/controllers/anoubis/core/data/actions.rb +15 -15
- data/app/controllers/anoubis/core/data/callbacks.rb +5 -5
- data/app/controllers/anoubis/core/data/convert.rb +33 -33
- data/app/controllers/anoubis/core/data/defaults.rb +8 -8
- data/app/controllers/anoubis/core/data/get.rb +14 -14
- data/app/controllers/anoubis/core/data/load.rb +3 -3
- data/app/controllers/anoubis/core/data/set.rb +2 -2
- data/app/controllers/anoubis/core/data/setup.rb +5 -5
- data/app/controllers/anoubis/core/data_controller.rb +10 -10
- data/app/controllers/anoubis/core/index/actions.rb +2 -2
- data/app/controllers/anoubis/core/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/core/index_controller.rb +4 -4
- data/app/controllers/anoubis/etc/base.rb +16 -11
- data/app/controllers/anoubis/etc/data.rb +1 -1
- data/app/controllers/anoubis/etc/field.rb +10 -10
- data/app/controllers/anoubis/etc/field_options.rb +1 -1
- data/app/controllers/anoubis/etc/field_order.rb +1 -1
- data/app/controllers/anoubis/etc/filter.rb +2 -2
- data/app/controllers/anoubis/etc/menu.rb +2 -2
- data/app/controllers/anoubis/etc/model.rb +1 -1
- data/app/controllers/anoubis/etc/tab_item.rb +1 -1
- data/app/controllers/anoubis/etc.rb +1 -1
- data/app/controllers/anoubis/export.rb +1 -1
- data/app/controllers/anoubis/output/autocomplete.rb +1 -1
- data/app/controllers/anoubis/output/basic.rb +1 -1
- data/app/controllers/anoubis/output/data.rb +1 -1
- data/app/controllers/anoubis/output/delete.rb +1 -1
- data/app/controllers/anoubis/output/edit.rb +1 -1
- data/app/controllers/anoubis/output/frame.rb +5 -5
- data/app/controllers/anoubis/output/login.rb +1 -1
- data/app/controllers/anoubis/output/menu.rb +3 -3
- data/app/controllers/anoubis/output/update.rb +1 -1
- data/app/controllers/anoubis/sso/client/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/actions.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/callbacks.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/convert.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/defaults.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/get.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/load.rb +6 -6
- data/app/controllers/anoubis/sso/client/data/set.rb +2 -2
- data/app/controllers/anoubis/sso/client/data/setup.rb +2 -2
- data/app/controllers/anoubis/sso/client/data_controller.rb +9 -9
- data/app/controllers/anoubis/sso/client/index/actions.rb +6 -6
- data/app/controllers/anoubis/sso/client/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/sso/client/index_controller.rb +3 -3
- data/app/controllers/anoubis/sso/server/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/server/login_controller.rb +1 -1
- data/app/controllers/anoubis/sso/server/user_controller.rb +1 -1
- data/app/controllers/anoubis/tenant/application_controller.rb +4 -4
- data/app/controllers/anoubis/tenant/data/actions.rb +2 -2
- data/app/controllers/anoubis/tenant/data/callbacks.rb +2 -2
- data/app/controllers/anoubis/tenant/data/convert.rb +2 -2
- data/app/controllers/anoubis/tenant/data/defaults.rb +2 -2
- data/app/controllers/anoubis/tenant/data/get.rb +2 -2
- data/app/controllers/anoubis/tenant/data/load.rb +5 -5
- data/app/controllers/anoubis/tenant/data/set.rb +2 -2
- data/app/controllers/anoubis/tenant/data/setup.rb +2 -2
- data/app/controllers/anoubis/tenant/data_controller.rb +10 -10
- data/app/controllers/anoubis/tenant/index/actions.rb +15 -15
- data/app/controllers/anoubis/tenant/index/callbacks.rb +2 -2
- data/app/controllers/anoubis/tenant/index_controller.rb +4 -4
- data/app/controllers/anoubis/tenants_controller.rb +1 -1
- data/app/controllers/anoubis/users_controller.rb +1 -1
- data/app/models/anoubis/application_record.rb +2 -2
- data/app/models/anoubis/core/application_record.rb +3 -3
- data/app/models/anoubis/sso/client/group_menu.rb +6 -6
- data/app/models/anoubis/sso/client/menu.rb +8 -8
- data/app/models/anoubis/sso/client/user.rb +3 -3
- data/app/models/anoubis/sso/server/user.rb +1 -1
- data/app/models/anoubis/tenant/group_menu.rb +5 -5
- data/app/models/anoubis/tenant/menu.rb +13 -13
- data/app/models/anoubis/tenant/system.rb +5 -5
- data/app/models/anoubis/tenant/user.rb +4 -4
- data/app/services/anoubis/session_service.rb +1 -1
- data/config/locales/en.yml +17 -2
- data/config/locales/ru.yml +18 -3
- data/db/seeds.rb +30 -30
- data/lib/anoubis/version.rb +1 -1
- data/lib/anoubis.rb +1 -1
- data/spec/controllers/anoubis/index_controller_spec.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/development_secret.txt +1 -0
- data/spec/models/anoubis/group_locale_spec.rb +1 -1
- data/spec/models/anoubis/group_menu_spec.rb +6 -6
- data/spec/models/anoubis/group_spec.rb +3 -3
- data/spec/models/anoubis/menu_locale_spec.rb +1 -1
- data/spec/models/anoubis/menu_spec.rb +1 -1
- data/spec/models/anoubis/system_locale_spec.rb +1 -1
- data/spec/models/anoubis/system_menu_spec.rb +5 -5
- data/spec/models/anoubis/system_spec.rb +4 -4
- data/spec/models/anoubis/tenant_spec.rb +4 -4
- data/spec/models/anoubis/user_spec.rb +2 -2
- metadata +62 -56
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
2
|
# Main User model. Stores inforation about all users that can access to the portal.
|
3
|
-
class
|
3
|
+
class Anoubis::Tenant::User < ApplicationRecord
|
4
4
|
# @!attribute patronymic
|
5
5
|
# @return [String] user's patronymic
|
6
6
|
|
@@ -70,8 +70,8 @@ class Anubis::Tenant::User < ApplicationRecord
|
|
70
70
|
|
71
71
|
# @!attribute tenant
|
72
72
|
# @return [Tenant] the tenant that owns this user.
|
73
|
-
belongs_to :tenant, class_name: '
|
74
|
-
has_many :user_groups, class_name: '
|
73
|
+
belongs_to :tenant, class_name: 'Anoubis::Tenant::Tenant'
|
74
|
+
has_many :user_groups, class_name: 'Anoubis::Tenant::UserGroup'
|
75
75
|
|
76
76
|
has_one_attached :avatar
|
77
77
|
|
@@ -145,7 +145,7 @@ class Anubis::Tenant::User < ApplicationRecord
|
|
145
145
|
throw(:abort, __method__)
|
146
146
|
end
|
147
147
|
|
148
|
-
|
148
|
+
Anoubis::Tenant::UserGroup.where(user_id: self.id).delete_all
|
149
149
|
end
|
150
150
|
|
151
151
|
##
|
data/config/locales/en.yml
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
en:
|
2
|
-
success: Successful
|
3
2
|
errors:
|
4
3
|
no_api_version: API version not defined
|
5
4
|
invalid_locale: Invalid locale
|
@@ -28,10 +27,26 @@ en:
|
|
28
27
|
page_title: Users management
|
29
28
|
short_title: Users
|
30
29
|
|
30
|
+
|
31
|
+
|
32
|
+
|
31
33
|
anoubis:
|
34
|
+
all: All
|
35
|
+
success: Successful
|
36
|
+
error: Error
|
37
|
+
install:
|
38
|
+
menu:
|
39
|
+
dashboard:
|
40
|
+
title: Dashboard
|
41
|
+
page_title: Dashboad
|
42
|
+
short_title: Dashboard
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
32
47
|
default_tab: Default
|
33
48
|
default_tab_hint: This is default tab
|
34
|
-
|
49
|
+
install2:
|
35
50
|
groups:
|
36
51
|
admin: Administrators
|
37
52
|
user: Users
|
data/config/locales/ru.yml
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
ru:
|
2
|
-
all: Все
|
3
|
-
success: Успешное завершение
|
4
2
|
actions:
|
5
3
|
edit: "Редактировать: %{title}"
|
6
4
|
delete: "Удалить: %{title}"
|
@@ -32,7 +30,24 @@ ru:
|
|
32
30
|
page_title: Управление пользователями
|
33
31
|
short_title: Пользователи
|
34
32
|
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
35
38
|
anoubis:
|
39
|
+
all: Все
|
40
|
+
success: Успешное завершение
|
41
|
+
error: Ошибка
|
42
|
+
install:
|
43
|
+
menu:
|
44
|
+
dashboard:
|
45
|
+
title: Дашборд
|
46
|
+
page_title: Дашборд
|
47
|
+
short_title: Дашборд
|
48
|
+
|
49
|
+
|
50
|
+
|
36
51
|
core:
|
37
52
|
success: Завершено корректно
|
38
53
|
errors:
|
@@ -82,7 +97,7 @@ ru:
|
|
82
97
|
- окт
|
83
98
|
- ноя
|
84
99
|
- дек
|
85
|
-
|
100
|
+
install2:
|
86
101
|
groups:
|
87
102
|
admin: Администраторы
|
88
103
|
user: Пользователи
|
data/db/seeds.rb
CHANGED
@@ -5,16 +5,16 @@ def create_tenant(params = {})
|
|
5
5
|
return nil if !params.has_key? :ident
|
6
6
|
return nil if !params.has_key? :title
|
7
7
|
|
8
|
-
tenant =
|
8
|
+
tenant = Anoubis::Tenant::Tenant.find_or_create_by ident: params[:ident]
|
9
9
|
tenant.title = params[:title]
|
10
10
|
if params.has_key? :default
|
11
11
|
if params[:default]
|
12
|
-
tenant.state =
|
12
|
+
tenant.state = Anoubis::Tenant::Tenant.states[:default]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
tenant.save
|
16
16
|
|
17
|
-
|
17
|
+
Anoubis::Tenant::TenantSystem.find_or_create_by tenant: tenant, system_id: 1
|
18
18
|
|
19
19
|
return tenant
|
20
20
|
end
|
@@ -31,7 +31,7 @@ def create_menu(params = {})
|
|
31
31
|
prefix = 'install.menu.'+params[:mode].to_s
|
32
32
|
|
33
33
|
if get_anubis_type == 'tenant'
|
34
|
-
data =
|
34
|
+
data = Anoubis::Tenant::Menu.find_or_create_by(mode: params[:mode]) do |menu|
|
35
35
|
menu.action = params[:action]
|
36
36
|
menu.menu = params[:parent] if params.key? :parent
|
37
37
|
menu.page_size = params[:page_size] if params.key? :page_size
|
@@ -40,7 +40,7 @@ def create_menu(params = {})
|
|
40
40
|
|
41
41
|
I18n.available_locales.each do |locale|
|
42
42
|
I18n.locale = locale
|
43
|
-
|
43
|
+
Anoubis::Tenant::MenuLocale.find_or_create_by(menu_id: data.id, locale: Anoubis::Tenant::MenuLocale.locales[locale.to_s.to_sym]) do |menu_locale|
|
44
44
|
menu_locale.title = I18n.t(prefix+'.title')
|
45
45
|
menu_locale.page_title = I18n.t(prefix+'.page_title')
|
46
46
|
menu_locale.short_title = I18n.t(prefix+'.short_title', default: [(prefix+'.title').to_sym])
|
@@ -50,10 +50,10 @@ def create_menu(params = {})
|
|
50
50
|
if params.has_key?(:group) && params.has_key?(:system)
|
51
51
|
if params[:system].is_a? Array
|
52
52
|
params[:system].each do |system|
|
53
|
-
|
53
|
+
Anoubis::Tenant::SystemMenu.find_or_create_by system: system, menu: data
|
54
54
|
end
|
55
55
|
else
|
56
|
-
|
56
|
+
Anoubis::Tenant::SystemMenu.find_or_create_by system: params[:system], menu: data
|
57
57
|
end
|
58
58
|
|
59
59
|
if params[:group].is_a? Array
|
@@ -67,7 +67,7 @@ def create_menu(params = {})
|
|
67
67
|
end
|
68
68
|
|
69
69
|
if get_anubis_type == 'sso-client'
|
70
|
-
data =
|
70
|
+
data = Anoubis::Sso::Client::Menu.find_or_create_by(mode: params[:mode])
|
71
71
|
|
72
72
|
#puts data.to_json
|
73
73
|
|
@@ -117,11 +117,11 @@ def create_system(params = {})
|
|
117
117
|
return nil if !params.has_key? :ident
|
118
118
|
return nil if !params.has_key? :translate
|
119
119
|
|
120
|
-
system =
|
120
|
+
system = Anoubis::Tenant::System.find_or_create_by ident: params[:ident]
|
121
121
|
if system
|
122
122
|
I18n.available_locales.each do |locale|
|
123
123
|
I18n.locale = locale
|
124
|
-
|
124
|
+
Anoubis::Tenant::SystemLocale.find_or_create_by(system: system, locale: Anoubis::Tenant::SystemLocale.locales[locale.to_s.to_sym]) do |system_locale|
|
125
125
|
system_locale.title = I18n.t(params[:translate])
|
126
126
|
end
|
127
127
|
end
|
@@ -130,10 +130,10 @@ def create_system(params = {})
|
|
130
130
|
if params.has_key? :tenant
|
131
131
|
if params[:tenant].is_a? Array
|
132
132
|
params[:tenant].each do |tenant|
|
133
|
-
|
133
|
+
Anoubis::Tenant::TenantSystem.find_or_create_by tenant: tenant, system: system
|
134
134
|
end
|
135
135
|
else
|
136
|
-
|
136
|
+
Anoubis::Tenant::TenantSystem.find_or_create_by tenant: params[:tenant], system: system
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -149,11 +149,11 @@ def create_group(params = {})
|
|
149
149
|
if get_anubis_type == 'tenant'
|
150
150
|
return nil if !params.has_key? :system
|
151
151
|
|
152
|
-
group =
|
152
|
+
group = Anoubis::Tenant::Group.find_or_create_by ident: params[:ident], system: params[:system]
|
153
153
|
if group
|
154
154
|
I18n.available_locales.each do |locale|
|
155
155
|
I18n.locale = locale
|
156
|
-
|
156
|
+
Anoubis::Tenant::GroupLocale.find_or_create_by(group: group, locale: Anoubis::Tenant::GroupLocale.locales[locale.to_s.to_sym]) do |group_locale|
|
157
157
|
group_locale.title = I18n.t(params[:translate])
|
158
158
|
end
|
159
159
|
end
|
@@ -162,16 +162,16 @@ def create_group(params = {})
|
|
162
162
|
if params.has_key? :user
|
163
163
|
if params[:user].is_a? Array
|
164
164
|
params[:user].each do |user|
|
165
|
-
|
165
|
+
Anoubis::Tenant::UserGroup.find_or_create_by group: group, user: user
|
166
166
|
end
|
167
167
|
else
|
168
|
-
|
168
|
+
Anoubis::Tenant::UserGroup.find_or_create_by group: group, user: params[:user]
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
173
|
if get_anubis_type == 'sso-client'
|
174
|
-
group =
|
174
|
+
group = Anoubis::Sso::Client::Group.find_or_create_by ident: params[:ident]
|
175
175
|
|
176
176
|
if group
|
177
177
|
I18n.available_locales.each do |locale|
|
@@ -192,8 +192,8 @@ def add_access_menu(params = {})
|
|
192
192
|
params[:access] = 'read' if !params.has_key? :access
|
193
193
|
|
194
194
|
if %w[tenant sso-client].include? get_anubis_type
|
195
|
-
group_menu_model =
|
196
|
-
group_menu_model =
|
195
|
+
group_menu_model = Anoubis::Tenant::GroupMenu if get_anubis_type == 'tenant'
|
196
|
+
group_menu_model = Anoubis::Sso::Client::GroupMenu if get_anubis_type == 'sso-client'
|
197
197
|
|
198
198
|
if params[:group].class == Array
|
199
199
|
params[:group].each do |group|
|
@@ -227,40 +227,40 @@ end
|
|
227
227
|
if get_anubis_type == 'tenant'
|
228
228
|
##
|
229
229
|
# Create default system with id 1
|
230
|
-
system =
|
230
|
+
system = Anoubis::Tenant::System.find_by_id(1)
|
231
231
|
if !system
|
232
|
-
system =
|
232
|
+
system = Anoubis::Tenant::System.create(id: 1)
|
233
233
|
end
|
234
234
|
I18n.available_locales.each do |locale|
|
235
235
|
I18n.locale = locale
|
236
|
-
|
236
|
+
Anoubis::Tenant::SystemLocale.find_or_create_by(system_id: system.id, locale: Anoubis::Tenant::SystemLocale.locales[locale.to_s.to_sym]) do |system_locale|
|
237
237
|
system_locale.title = I18n.t('anubis.install.system_title')
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
241
|
##
|
242
242
|
# Create default tenant with id 1
|
243
|
-
tenant =
|
244
|
-
tenant =
|
243
|
+
tenant = Anoubis::Tenant::Tenant.find_by_id(1)
|
244
|
+
tenant = Anoubis::Tenant::Tenant.create(id: 1, title: I18n.t('anubis.install.tenant_title'), state: Anoubis::Tenant::Tenant.states[:default]) if !tenant
|
245
245
|
|
246
|
-
|
246
|
+
Anoubis::Tenant::TenantSystem.find_or_create_by tenant: tenant, system: system
|
247
247
|
|
248
248
|
##
|
249
249
|
# Load Administrator group of Main System
|
250
|
-
admin_group =
|
250
|
+
admin_group = Anoubis::Tenant::Group.where(system: system, ident: 'admin').first
|
251
251
|
I18n.available_locales.each do |locale|
|
252
252
|
I18n.locale = locale
|
253
|
-
|
253
|
+
Anoubis::Tenant::GroupLocale.find_or_create_by(group_id: admin_group.id, locale: Anoubis::Tenant::GroupLocale.locales[locale.to_s.to_sym]) do |group_locale|
|
254
254
|
group_locale.title = I18n.t('anubis.install.admins_group')
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
258
|
##
|
259
259
|
# Create main administrator with id 1
|
260
|
-
admin_user =
|
261
|
-
admin_user =
|
260
|
+
admin_user = Anoubis::Tenant::User.find_by_id(1)
|
261
|
+
admin_user = Anoubis::Tenant::User.create(id: 1, email: 'admin@local.local', name: I18n.t('anubis.install.admin_name'), surname: I18n.t('anubis.install.admin_surname'), timezone: 'GMT', status: 0, tenant: tenant) if !admin_user
|
262
262
|
|
263
|
-
|
263
|
+
Anoubis::Tenant::UserGroup.find_or_create_by(user_id: admin_user.id, group_id: admin_group.id)
|
264
264
|
|
265
265
|
menu_0 = create_menu({ mode: 'anubis/admin', action: 'menu' })
|
266
266
|
menu_1 = create_menu({ mode: 'anubis/tenants', action: 'data', parent: menu_0, system: system, group: admin_group, access: 'write' })
|
data/lib/anoubis/version.rb
CHANGED
data/lib/anoubis.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
b714976384f5d8e128e9d5c58df9222bcc4080b2f24285167f4ded45cac2aa0dbc2fdb53441fb6cd83176c54a5a98dbe0c4c7e02e85188f571fb930abe770dac
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe GroupMenu, type: :model do
|
5
5
|
before(:all) do
|
6
6
|
@system = create :system, ident: 'test'
|
@@ -21,7 +21,7 @@ module Anubis
|
|
21
21
|
|
22
22
|
it "check created tree" do
|
23
23
|
create :group_menu, group: @group, menu: @menu3
|
24
|
-
expect(
|
24
|
+
expect(Anoubis::GroupMenu.where(group: @group).count(:id)).to eq 3
|
25
25
|
end
|
26
26
|
|
27
27
|
it "can destroy" do
|
@@ -32,16 +32,16 @@ module Anubis
|
|
32
32
|
|
33
33
|
it "can destroy tree" do
|
34
34
|
create :group_menu, group: @group, menu: @menu3
|
35
|
-
|
36
|
-
expect(
|
35
|
+
Anoubis::GroupMenu.where(group: @group, menu: @menu1).first.destroy
|
36
|
+
expect(Anoubis::GroupMenu.where(group: @group).count(:id)).to eq 0
|
37
37
|
end
|
38
38
|
|
39
39
|
after(:all) do
|
40
|
-
|
40
|
+
Anoubis::SystemMenu.where(system: @system, menu: @menu1).first.destroy
|
41
41
|
@menu3.destroy
|
42
42
|
@menu2.destroy
|
43
43
|
@menu1.destroy
|
44
|
-
|
44
|
+
Anoubis::Group.where(system_id: @system.id).each do |item|
|
45
45
|
item.destroy
|
46
46
|
end
|
47
47
|
@system.destroy
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe Group, type: :model do
|
5
5
|
it "is valid" do
|
6
6
|
expect(build_stubbed(:group)).to be_valid
|
@@ -32,7 +32,7 @@ module Anubis
|
|
32
32
|
|
33
33
|
it "can't change admin group ident" do
|
34
34
|
system = create :system
|
35
|
-
group =
|
35
|
+
group = Anoubis::Group.where(system: system, ident: 'admin').first
|
36
36
|
group.ident = 'tst'
|
37
37
|
expect(group.save).to eq false
|
38
38
|
end
|
@@ -44,7 +44,7 @@ module Anubis
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "can't destroy admin group of main system" do
|
47
|
-
group =
|
47
|
+
group = Anoubis::Group.where(system_id: 1, ident: 'admin').first
|
48
48
|
group.destroy
|
49
49
|
expect(group.destroyed?).to eq false
|
50
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe SystemMenu, type: :model do
|
5
5
|
before(:all) do
|
6
6
|
@system = create :system, ident: 'test'
|
@@ -20,7 +20,7 @@ module Anubis
|
|
20
20
|
|
21
21
|
it "check created tree" do
|
22
22
|
create :system_menu, system: @system, menu: @menu3
|
23
|
-
expect(
|
23
|
+
expect(Anoubis::SystemMenu.where(system: @system).count(:id)).to eq 3
|
24
24
|
end
|
25
25
|
|
26
26
|
it "can destroy" do
|
@@ -31,8 +31,8 @@ module Anubis
|
|
31
31
|
|
32
32
|
it "can destroy tree" do
|
33
33
|
create :system_menu, system: @system, menu: @menu3
|
34
|
-
|
35
|
-
expect(
|
34
|
+
Anoubis::SystemMenu.where(system: @system, menu: @menu1).first.destroy
|
35
|
+
expect(Anoubis::SystemMenu.where(system: @system).count(:id)).to eq 0
|
36
36
|
end
|
37
37
|
|
38
38
|
after(:all) do
|
@@ -40,7 +40,7 @@ module Anubis
|
|
40
40
|
@menu2.destroy
|
41
41
|
@menu1.destroy
|
42
42
|
#@group.destroy
|
43
|
-
|
43
|
+
Anoubis::Group.where(system_id: @system.id).each do |item|
|
44
44
|
item.destroy
|
45
45
|
end
|
46
46
|
@system.destroy
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe System, type: :model do
|
5
5
|
it "is valid" do
|
6
6
|
expect(build_stubbed(:system)).to be_valid
|
@@ -30,14 +30,14 @@ module Anubis
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "can't change main system ident" do
|
33
|
-
system =
|
33
|
+
system = Anoubis::System.find(1)
|
34
34
|
system.ident = 'tst'
|
35
35
|
expect(system.save).to eq false
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can destroy" do
|
39
39
|
system = create :system, ident: 'dst'
|
40
|
-
|
40
|
+
Anoubis::Group.where(system_id: system.id).each do |item|
|
41
41
|
item.destroy
|
42
42
|
end
|
43
43
|
system.destroy
|
@@ -45,7 +45,7 @@ module Anubis
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "can't destroy main system" do
|
48
|
-
system =
|
48
|
+
system = Anoubis::System.find(1)
|
49
49
|
system.destroy
|
50
50
|
expect(system.destroyed?).to eq false
|
51
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe Tenant, type: :model do
|
5
5
|
it "is valid" do
|
6
6
|
expect(build_stubbed(:tenant)).to be_valid
|
@@ -44,14 +44,14 @@ module Anubis
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "can't change system tenant ident" do
|
47
|
-
tenant =
|
47
|
+
tenant = Anoubis::Tenant.find(1)
|
48
48
|
tenant.ident = 'tst'
|
49
49
|
expect(tenant.save).to eq false
|
50
50
|
end
|
51
51
|
|
52
52
|
it "can destroy" do
|
53
53
|
tenant = create :tenant, title: 'Destroy', ident: 'dst'
|
54
|
-
|
54
|
+
Anoubis::TenantSystem.where(tenant_id: tenant.id).each do |item|
|
55
55
|
item.destroy
|
56
56
|
end
|
57
57
|
tenant.destroy
|
@@ -59,7 +59,7 @@ module Anubis
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "can't destroy system tenant" do
|
62
|
-
tenant =
|
62
|
+
tenant = Anoubis::Tenant.find(1)
|
63
63
|
tenant.destroy
|
64
64
|
expect(tenant.destroyed?).to eq false
|
65
65
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Anoubis
|
4
4
|
RSpec.describe User, type: :model do
|
5
5
|
it "is valid" do
|
6
6
|
expect(build_stubbed(:user)).to be_valid
|
@@ -49,7 +49,7 @@ module Anubis
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "can't destroy Main Administrator" do
|
52
|
-
user =
|
52
|
+
user = Anoubis::User.find(1)
|
53
53
|
user.destroy
|
54
54
|
expect(user.destroyed?).to eq false
|
55
55
|
end
|