-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add social settings access ability #214
base: master
Are you sure you want to change the base?
Add social settings access ability #214
Conversation
it { is_expected.not_to be_able_to(:manage, Spree::SocialConfiguration) } | ||
end | ||
|
||
context 'when is admin' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
describe 'social configuration settings' do | ||
subject { described_class.new(user) } | ||
|
||
context 'when is ordinal user' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
require 'cancan/matchers' | ||
|
||
RSpec.describe Spree::SocialAuthenticationAbilities, type: :model do | ||
describe 'social configuration settings' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -0,0 +1,19 @@ | |||
require 'cancan/matchers' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -2,5 +2,5 @@ | |||
virtual_path: 'spree/admin/shared/sub_menu/_configuration', | |||
name: 'add_social_providers_link_configuration_menu', | |||
insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]', | |||
text: '<%= configurations_sidebar_menu_item Spree.t(:social_authentication_methods), spree.admin_authentication_methods_path %>' | |||
text: '<%= configurations_sidebar_menu_item(Spree.t(:social_authentication_methods), spree.admin_authentication_methods_path) if can?(:manage, Spree::SocialConfiguration) %>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [176/80]
include CanCan::Ability | ||
|
||
def initialize(user) | ||
if user.respond_to?(:has_spree_role?) && user.has_spree_role?('admin') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -0,0 +1,9 @@ | |||
class Spree::SocialAuthenticationAbilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
Use nested module/class definitions instead of compact style.
it { is_expected.not_to be_able_to(:manage, Spree::SocialConfiguration) } | ||
end | ||
|
||
context 'when is admin' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
describe 'social configuration settings' do | ||
subject { described_class.new(user) } | ||
|
||
context 'when is ordinal user' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
require 'cancan/matchers' | ||
|
||
RSpec.describe Spree::SocialAuthenticationAbilities, type: :model do | ||
describe 'social configuration settings' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -0,0 +1,19 @@ | |||
require 'cancan/matchers' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -2,5 +2,5 @@ | |||
virtual_path: 'spree/admin/shared/sub_menu/_configuration', | |||
name: 'add_social_providers_link_configuration_menu', | |||
insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]', | |||
text: '<%= configurations_sidebar_menu_item Spree.t(:social_authentication_methods), spree.admin_authentication_methods_path %>' | |||
text: '<%= configurations_sidebar_menu_item(Spree.t(:social_authentication_methods), spree.admin_authentication_methods_path) if can?(:manage, Spree::SocialConfiguration) %>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [176/80]
include CanCan::Ability | ||
|
||
def initialize(user) | ||
if user.respond_to?(:has_spree_role?) && user.has_spree_role?('admin') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -0,0 +1,9 @@ | |||
class Spree::SocialAuthenticationAbilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
Use nested module/class definitions instead of compact style.
Useful when users (e.g vendors) can have access to admin panel