adminpanel 2.1.7 → 2.2.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +11 -3
- data/Gemfile +3 -27
- data/adminpanel.gemspec +24 -23
- data/app/assets/images/adminpanel/loguito.png +0 -0
- data/app/assets/javascripts/adminpanel/bootstrap-wysihtml5-4pre.js +120 -120
- data/app/assets/javascripts/adminpanel/spinner.js.coffee +6 -6
- data/app/assets/stylesheets/adminpanel/bootstrap-wysihtml5.css +21 -75
- data/app/controllers/adminpanel/analytics_controller.rb +34 -2
- data/app/controllers/adminpanel/application_controller.rb +7 -6
- data/app/controllers/adminpanel/categories_controller.rb +0 -1
- data/app/controllers/adminpanel/galleries_controller.rb +0 -1
- data/app/controllers/adminpanel/permissions_controller.rb +14 -0
- data/app/controllers/adminpanel/rols_controller.rb +10 -0
- data/app/controllers/adminpanel/sections_controller.rb +11 -14
- data/app/controllers/adminpanel/sessions_controller.rb +45 -11
- data/app/controllers/adminpanel/users_controller.rb +2 -4
- data/app/controllers/concerns/adminpanel/analytics/instagram_analytics.rb +31 -0
- data/app/controllers/concerns/adminpanel/analytics/twitter_analytics.rb +25 -0
- data/app/controllers/concerns/adminpanel/facebook_actions.rb +7 -5
- data/app/controllers/concerns/adminpanel/rest_actions.rb +12 -0
- data/app/controllers/concerns/adminpanel/twitter_actions.rb +40 -0
- data/app/helpers/adminpanel/adminpanel_form_builder.rb +21 -14
- data/app/helpers/adminpanel/analytics_helper.rb +22 -2
- data/app/helpers/adminpanel/application_helper.rb +2 -2
- data/app/helpers/adminpanel/breadcrumbs_helper.rb +8 -6
- data/app/helpers/adminpanel/router_helper.rb +4 -0
- data/app/helpers/adminpanel/sessions_helper.rb +2 -2
- data/app/helpers/adminpanel/shared_pages_helper.rb +3 -3
- data/{lib/generators/adminpanel/initialize/templates → app/models}/ability.rb +18 -6
- data/app/models/adminpanel/analytic.rb +1 -0
- data/app/models/adminpanel/auth.rb +4 -1
- data/app/models/adminpanel/permission.rb +52 -0
- data/app/models/adminpanel/rol.rb +35 -0
- data/app/models/adminpanel/user.rb +8 -8
- data/app/models/concerns/adminpanel/base.rb +4 -0
- data/app/models/concerns/adminpanel/facebook.rb +1 -1
- data/app/models/concerns/adminpanel/twitter.rb +27 -0
- data/app/views/adminpanel/analytics/{_widget_task_statistics.html.erb → _fb_statistic_widget.html.erb} +0 -0
- data/app/views/adminpanel/analytics/_header.html.erb +8 -2
- data/app/views/adminpanel/analytics/_instagram_details_modal.html.erb +55 -0
- data/app/views/adminpanel/analytics/_instagram_media.html.erb +25 -0
- data/app/views/adminpanel/analytics/_tweet.html.erb +32 -0
- data/app/views/adminpanel/analytics/_twitter_reply_modal.html.erb +41 -0
- data/app/views/adminpanel/analytics/fb.html.erb +6 -6
- data/app/views/adminpanel/analytics/instagram.html.erb +65 -0
- data/app/views/adminpanel/analytics/twitter.html.erb +89 -0
- data/app/views/adminpanel/sections/edit.html.erb +2 -5
- data/app/views/layouts/_side_menu.html.erb +3 -3
- data/app/views/layouts/admin.html.erb +2 -2
- data/app/views/shared/_delete_icon_button.html.erb +1 -1
- data/app/views/shared/_edit_icon_button.html.erb +1 -1
- data/app/views/shared/_fb_icon_button.html.erb +1 -1
- data/app/views/shared/_form_fields.html.erb +1 -1
- data/app/views/shared/_new_resource_button.html.erb +1 -2
- data/app/views/shared/_twitter_icon_button.html.erb +26 -0
- data/app/views/shared/_twitter_publish_modal.html.erb +40 -0
- data/app/views/shared/index.html.erb +5 -3
- data/app/views/shared/show.html.erb +7 -3
- data/config/initializers/twitter-oauth.rb +15 -0
- data/config/locales/en.yml +1 -1
- data/config/locales/es.yml +20 -1
- data/config/routes.rb +25 -5
- data/lib/adminpanel.rb +3 -0
- data/lib/adminpanel/engine.rb +19 -5
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/initialize/initialize_generator.rb +0 -11
- data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +12 -0
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_tables.rb +74 -46
- data/lib/generators/adminpanel/resource/resource_generator_helper.rb +1 -1
- data/lib/generators/adminpanel/resource/templates/adminpanel_resource_template.rb +1 -1
- data/lib/tasks/adminpanel/adminpanel.rake +5 -5
- data/test/dummy/app/models/adminpanel/item.rb +1 -1
- data/test/dummy/app/models/adminpanel/mug.rb +1 -0
- data/test/dummy/app/models/adminpanel/photo.rb +4 -0
- data/test/dummy/app/models/adminpanel/product.rb +7 -1
- data/test/dummy/app/models/adminpanel/salesman.rb +1 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -1
- data/test/dummy/db/schema.rb +9 -2
- data/test/dummy/test/fixtures/adminpanel/permissions.yml +42 -0
- data/test/dummy/test/fixtures/adminpanel/rols.yml +28 -0
- data/test/dummy/test/fixtures/adminpanel/salesmen.yml +1 -0
- data/test/dummy/test/fixtures/adminpanel/users.yml +49 -1
- data/test/features/shared/resource/index_test.rb +1 -0
- data/test/features/shared/ui/action_exclution_test.rb +1 -0
- data/test/helpers/breadcrumbs_helper_test.rb +34 -0
- data/test/helpers/router_helper_test.rb +21 -0
- data/test/helpers/shared_pages_helper_test.rb +35 -0
- data/test/models/ability_test.rb +52 -0
- data/test/models/adminpanel/gallery_test.rb +0 -2
- data/test/models/adminpanel/user_test.rb +1 -1
- data/test/support/shared_database.rb +11 -0
- data/test/support/view_case.rb +34 -0
- data/test/tasks/adminpanel_rake_test.rb +5 -2
- data/test/test_helper.rb +1 -41
- metadata +191 -200
- data/app/assets/javascripts/adminpanel/jquery.facybox.js +0 -395
- data/app/assets/stylesheets/adminpanel/facybox.css +0 -146
- data/app/models/adminpanel/group.rb +0 -6
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/models/ability.rb +0 -31
- data/test/dummy/test/fixtures/adminpanel/groups.yml +0 -4
|
@@ -41,17 +41,17 @@ namespace :adminpanel do
|
|
|
41
41
|
user.delete
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
if
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
rol = Adminpanel::Rol.find_by_name("Admin")
|
|
45
|
+
if rol.nil?
|
|
46
|
+
rol = Adminpanel::Rol.new(:name => "Admin")
|
|
47
|
+
rol.save
|
|
48
48
|
end
|
|
49
49
|
Adminpanel::User.new(
|
|
50
50
|
:email => 'webmaster@codn.com',
|
|
51
51
|
:name => 'Webmaster',
|
|
52
52
|
:password => password,
|
|
53
53
|
:password_confirmation => password,
|
|
54
|
-
:
|
|
54
|
+
:rol_id => rol.id
|
|
55
55
|
).save
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module Adminpanel
|
|
2
2
|
class Product < ActiveRecord::Base
|
|
3
3
|
include Adminpanel::Base
|
|
4
|
+
include Adminpanel::Facebook
|
|
5
|
+
include Adminpanel::Twitter
|
|
4
6
|
|
|
5
7
|
has_many :categorizations
|
|
6
8
|
has_many :categories, :through => :categorizations
|
|
@@ -47,8 +49,12 @@ module Adminpanel
|
|
|
47
49
|
"Producto"
|
|
48
50
|
end
|
|
49
51
|
|
|
52
|
+
def self.gallery_children
|
|
53
|
+
'photos'
|
|
54
|
+
end
|
|
55
|
+
|
|
50
56
|
def self.icon
|
|
51
|
-
|
|
57
|
+
"icon-truck"
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
end
|
data/test/dummy/db/schema.rb
CHANGED
|
@@ -16,7 +16,7 @@ ActiveRecord::Schema.define do
|
|
|
16
16
|
t.string :email
|
|
17
17
|
t.string :password_digest
|
|
18
18
|
t.string :remember_token
|
|
19
|
-
t.integer :
|
|
19
|
+
t.integer :rol_id
|
|
20
20
|
t.datetime :created_at, :null => false
|
|
21
21
|
t.datetime :updated_at, :null => false
|
|
22
22
|
end
|
|
@@ -76,11 +76,18 @@ ActiveRecord::Schema.define do
|
|
|
76
76
|
t.datetime :created_at, :null => false
|
|
77
77
|
t.datetime :updated_at, :null => false
|
|
78
78
|
end
|
|
79
|
-
create_table :
|
|
79
|
+
create_table :adminpanel_rols do |t|
|
|
80
80
|
t.string :name
|
|
81
81
|
t.datetime :created_at, :null => false
|
|
82
82
|
t.datetime :updated_at, :null => false
|
|
83
83
|
end
|
|
84
|
+
create_table :adminpanel_permissions do |t|
|
|
85
|
+
t.integer :rol_id
|
|
86
|
+
t.integer :action
|
|
87
|
+
t.string :resource
|
|
88
|
+
t.datetime :created_at, :null => false
|
|
89
|
+
t.datetime :updated_at, :null => false
|
|
90
|
+
end
|
|
84
91
|
create_table :adminpanel_mugs do |t|
|
|
85
92
|
t.string :name
|
|
86
93
|
t.integer :number
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
publish:
|
|
2
|
+
rol: Publisher
|
|
3
|
+
action: 1
|
|
4
|
+
resource: product
|
|
5
|
+
created_at: <%= Date.today %>
|
|
6
|
+
updated_at: <%= Date.today %>
|
|
7
|
+
create:
|
|
8
|
+
rol: Creator
|
|
9
|
+
action: 2
|
|
10
|
+
resource: product
|
|
11
|
+
created_at: <%= Date.today %>
|
|
12
|
+
updated_at: <%= Date.today %>
|
|
13
|
+
update:
|
|
14
|
+
rol: Updater
|
|
15
|
+
action: 3
|
|
16
|
+
resource: product
|
|
17
|
+
created_at: <%= Date.today %>
|
|
18
|
+
updated_at: <%= Date.today %>
|
|
19
|
+
read:
|
|
20
|
+
rol: Reader
|
|
21
|
+
action: 0
|
|
22
|
+
resource: product
|
|
23
|
+
created_at: <%= Date.today %>
|
|
24
|
+
updated_at: <%= Date.today %>
|
|
25
|
+
deleter:
|
|
26
|
+
rol: Deleter
|
|
27
|
+
action: 4
|
|
28
|
+
resource: product
|
|
29
|
+
created_at: <%= Date.today %>
|
|
30
|
+
updated_at: <%= Date.today %>
|
|
31
|
+
create_product:
|
|
32
|
+
rol: Superuser
|
|
33
|
+
action: 2
|
|
34
|
+
resource: product
|
|
35
|
+
created_at: <%= Date.today %>
|
|
36
|
+
updated_at: <%= Date.today %>
|
|
37
|
+
update_product:
|
|
38
|
+
rol: Superuser
|
|
39
|
+
action: 3
|
|
40
|
+
resource: product
|
|
41
|
+
created_at: <%= Date.today %>
|
|
42
|
+
updated_at: <%= Date.today %>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Admin:
|
|
2
|
+
name: Admin
|
|
3
|
+
created_at: <%= Date.today %>
|
|
4
|
+
updated_at: <%= Date.today %>
|
|
5
|
+
Publisher:
|
|
6
|
+
name: Publisher
|
|
7
|
+
created_at: <%= Date.today %>
|
|
8
|
+
updated_at: <%= Date.today %>
|
|
9
|
+
Creator:
|
|
10
|
+
name: Creator
|
|
11
|
+
created_at: <%= Date.today %>
|
|
12
|
+
updated_at: <%= Date.today %>
|
|
13
|
+
Updater:
|
|
14
|
+
name: Updater
|
|
15
|
+
created_at: <%= Date.today %>
|
|
16
|
+
updated_at: <%= Date.today %>
|
|
17
|
+
Reader:
|
|
18
|
+
name: Reader
|
|
19
|
+
created_at: <%= Date.today %>
|
|
20
|
+
updated_at: <%= Date.today %>
|
|
21
|
+
Deleter:
|
|
22
|
+
name: Deleter
|
|
23
|
+
created_at: <%= Date.today %>
|
|
24
|
+
updated_at: <%= Date.today %>
|
|
25
|
+
Superuser:
|
|
26
|
+
name: Superuser
|
|
27
|
+
created_at: <%= Date.today %>
|
|
28
|
+
updated_at: <%= Date.today %>
|
|
@@ -3,6 +3,54 @@ valid:
|
|
|
3
3
|
email: user@example.com
|
|
4
4
|
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
5
5
|
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
6
|
-
|
|
6
|
+
rol: Admin
|
|
7
|
+
created_at: <%= Date.today %>
|
|
8
|
+
updated_at: <%= Date.today %>
|
|
9
|
+
publisher:
|
|
10
|
+
name: Publisher User
|
|
11
|
+
email: publisher@example.com
|
|
12
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
13
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
14
|
+
rol: Publisher
|
|
15
|
+
created_at: <%= Date.today %>
|
|
16
|
+
updated_at: <%= Date.today %>
|
|
17
|
+
creator:
|
|
18
|
+
name: Creator User
|
|
19
|
+
email: creator@example.com
|
|
20
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
21
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
22
|
+
rol: Creator
|
|
23
|
+
created_at: <%= Date.today %>
|
|
24
|
+
updated_at: <%= Date.today %>
|
|
25
|
+
updater:
|
|
26
|
+
name: Updator User
|
|
27
|
+
email: updator@example.com
|
|
28
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
29
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
30
|
+
rol: Updater
|
|
31
|
+
created_at: <%= Date.today %>
|
|
32
|
+
updated_at: <%= Date.today %>
|
|
33
|
+
deleter:
|
|
34
|
+
name: Deleter User
|
|
35
|
+
email: deleter@example.com
|
|
36
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
37
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
38
|
+
rol: Deleter
|
|
39
|
+
created_at: <%= Date.today %>
|
|
40
|
+
updated_at: <%= Date.today %>
|
|
41
|
+
reader:
|
|
42
|
+
name: Reader User
|
|
43
|
+
email: reader@example.com
|
|
44
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
45
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
46
|
+
rol: Reader
|
|
47
|
+
created_at: <%= Date.today %>
|
|
48
|
+
updated_at: <%= Date.today %>
|
|
49
|
+
superuser:
|
|
50
|
+
name: Super User
|
|
51
|
+
email: superuser@example.com
|
|
52
|
+
password_digest: <%= BCrypt::Password.create('foobar') %>
|
|
53
|
+
remember_token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
|
54
|
+
rol: Superuser
|
|
7
55
|
created_at: <%= Date.today %>
|
|
8
56
|
updated_at: <%= Date.today %>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class BreadrumbsHelperTest < ActionView::TestCase
|
|
4
|
+
include Adminpanel::BreadcrumbsHelper
|
|
5
|
+
include Rails.application.routes.url_helpers
|
|
6
|
+
|
|
7
|
+
fixtures :all
|
|
8
|
+
|
|
9
|
+
setup :setup
|
|
10
|
+
teardown :teardown
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
breadcrumb_add('controller', 'http://controller.com')
|
|
14
|
+
breadcrumb_add('action', 'http://action.com')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def teardown
|
|
18
|
+
@breadcrumb = nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_breadcrumb_add
|
|
22
|
+
|
|
23
|
+
assert_equal( { title: 'Inicio', url: adminpanel.root_url }, @breadcrumb.first)
|
|
24
|
+
assert_equal( { title: 'controller', url: 'http://controller.com' }, @breadcrumb.second)
|
|
25
|
+
assert_equal( { title: 'action', url: 'http://action.com' }, @breadcrumb.third)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_render_breadcrumb
|
|
29
|
+
assert_equal(
|
|
30
|
+
render_breadcrumb('divider'),
|
|
31
|
+
render(partial: 'shared/breadcrumb', locals: { nav: @breadcrumb, divider: 'divider' })
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class RouterHelperTest < ActionView::TestCase
|
|
4
|
+
include Adminpanel::RouterHelper
|
|
5
|
+
|
|
6
|
+
fixtures :all
|
|
7
|
+
|
|
8
|
+
def test_get_gallery_childen
|
|
9
|
+
assert_equal 'photos', get_gallery_children(:products)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_resource_parameters
|
|
13
|
+
assert_equal( { path: 'categorias' }, resources_parameters(:categories) )
|
|
14
|
+
assert_equal( { path: 'articulo-espacios-mayusculas-y-acentos' }, resources_parameters(:items) )
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_has_fb_share?
|
|
18
|
+
assert_equal false, has_fb_share?(:categories)
|
|
19
|
+
assert_equal true, has_fb_share?(:products)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class SharedPagesHelperTest < ActionView::TestCase
|
|
4
|
+
include Adminpanel::SharedPagesHelper
|
|
5
|
+
fixtures :all
|
|
6
|
+
|
|
7
|
+
def test_belong_to_object_name
|
|
8
|
+
@model = Adminpanel::Salesman
|
|
9
|
+
#according to fixtures and dummy app relationships
|
|
10
|
+
assert_equal 'Product saved', belong_to_object_name(adminpanel_salesmen(:one), 'product')
|
|
11
|
+
@model = nil
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_pluralize_model
|
|
15
|
+
assert_equal 'clients', pluralize_model('Adminpanel::Client')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_relaitionship_ids
|
|
19
|
+
assert_equal 'client_ids', relationship_ids('Adminpanel::Client')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_class_name_downcase
|
|
23
|
+
assert_equal 'category', class_name_downcase(Adminpanel::Category.new)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_demodulize_class
|
|
27
|
+
assert_equal 'product', demodulize_class('Adminpanel::Product')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_active_tab
|
|
31
|
+
assert_equal 'active', active_tab(0)
|
|
32
|
+
assert_equal '', active_tab([*1..15].sample)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class AbilityTest < ActiveSupport::TestCase
|
|
4
|
+
fixtures :all
|
|
5
|
+
|
|
6
|
+
def test_superuser_permission
|
|
7
|
+
ability = Ability.new(adminpanel_users(:valid))
|
|
8
|
+
|
|
9
|
+
assert ability.can?(:manage, :all)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_read_permission
|
|
13
|
+
ability = Ability.new(adminpanel_users(:reader))
|
|
14
|
+
|
|
15
|
+
assert ability.can?(:read, Adminpanel::Product)
|
|
16
|
+
assert ability.cannot?(:destroy, Adminpanel::Product)
|
|
17
|
+
assert ability.cannot?(:update, Adminpanel::Product)
|
|
18
|
+
assert ability.cannot?(:create, Adminpanel::Product)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_create_permission
|
|
22
|
+
ability = Ability.new(adminpanel_users(:creator))
|
|
23
|
+
|
|
24
|
+
assert ability.cannot?(:destroy, Adminpanel::Product)
|
|
25
|
+
assert ability.cannot?(:update, Adminpanel::Product)
|
|
26
|
+
assert ability.can?(:create, Adminpanel::Product)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_delete_permission
|
|
30
|
+
ability = Ability.new(adminpanel_users(:deleter))
|
|
31
|
+
|
|
32
|
+
assert ability.can?(:destroy, Adminpanel::Product)
|
|
33
|
+
assert ability.cannot?(:update, Adminpanel::Product)
|
|
34
|
+
assert ability.cannot?(:create, Adminpanel::Product)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_updater_permission
|
|
38
|
+
ability = Ability.new(adminpanel_users(:updater))
|
|
39
|
+
|
|
40
|
+
assert ability.cannot?(:destroy, Adminpanel::Product)
|
|
41
|
+
assert ability.can?(:update, Adminpanel::Product)
|
|
42
|
+
assert ability.cannot?(:create, Adminpanel::Product)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_superuser_permission
|
|
46
|
+
ability = Ability.new(adminpanel_users(:superuser))
|
|
47
|
+
|
|
48
|
+
assert ability.cannot?(:destroy, Adminpanel::Product)
|
|
49
|
+
assert ability.can?(:update, Adminpanel::Product)
|
|
50
|
+
assert ability.can?(:create, Adminpanel::Product)
|
|
51
|
+
end
|
|
52
|
+
end
|