Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

artplan1
Copy link

@artplan1 artplan1 commented Jan 25, 2018

Useful when users (e.g vendors) can have access to admin panel

it { is_expected.not_to be_able_to(:manage, Spree::SocialConfiguration) }
end

context 'when is admin' do

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

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

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'

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) %>'

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')

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

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

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

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

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'

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) %>'

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')

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants