-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
* Now all dependencies exist in one place (Much better than intermingled dependencies)
|
||
context 'when the subject is a model' do | ||
let(:right) { | ||
double(name: 'Do Something', can: true, action: 'action', subject: 'Model', conditions: {}) |
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.
Metrics/LineLength: Line is too long. [99/80]
end | ||
|
||
context 'when the subject is a model' do | ||
let(:right) { |
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.
Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
|
||
context 'when the subject is not a model' do | ||
let(:right) { | ||
double(name: 'Do Something', can: true, action: 'action', subject: 'subject', conditions: {}) |
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.
Metrics/LineLength: Line is too long. [101/80]
end | ||
|
||
context 'when the subject is not a model' do | ||
let(:right) { |
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.
Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
} | ||
|
||
it 'should fail with exception' do | ||
expect{rule}.to raise_error(RightOn::Error, 'must specify an action') |
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.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space missing inside {.
Layout/SpaceInsideBlockBraces: Space missing inside }.
@@ -0,0 +1,81 @@ | |||
require 'active_record' |
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.
Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
spec/right_allowed_spec.rb
Outdated
|
||
context 'edit action' do | ||
specify do | ||
expect(edit_action.allowed?(other)).to eq false # as specific action exists |
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.
Metrics/LineLength: Line is too long. [83/80]
spec/right_allowed_spec.rb
Outdated
|
||
context 'index action' do | ||
specify do | ||
expect(index_action.allowed?(other)).to eq false # as specific action exists |
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.
Metrics/LineLength: Line is too long. [84/80]
spec/right_allowed_spec.rb
Outdated
let(:other) { double(id: 2, name: 'models', controller: 'models', action: nil) } | ||
let(:index) { double(id: 3, name: 'models#index', controller: 'models', action: 'index') } | ||
let(:change) { double(id: 4, name: 'models#change', controller: 'models', action: 'change') } | ||
let(:view) { double(id: 5, name: 'models#view', controller: 'models', action: 'view') } |
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.
Metrics/LineLength: Line is too long. [97/80]
spec/right_allowed_spec.rb
Outdated
|
||
let(:other) { double(id: 2, name: 'models', controller: 'models', action: nil) } | ||
let(:index) { double(id: 3, name: 'models#index', controller: 'models', action: 'index') } | ||
let(:change) { double(id: 4, name: 'models#change', controller: 'models', action: 'change') } |
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.
Metrics/LineLength: Line is too long. [97/80]
spec/right_allowed_spec.rb
Outdated
end | ||
end | ||
|
||
context 'for complex rights' 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.
Metrics/BlockLength: Block has too many lines. [32/25]
spec/right_allowed_spec.rb
Outdated
require 'spec_helper' | ||
require 'support/bootstrap' | ||
|
||
describe RightOn::RightAllowed 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.
Metrics/BlockLength: Block has too many lines. [61/25]
spec/right_allowed_spec.rb
Outdated
@@ -0,0 +1,89 @@ | |||
require 'active_record' |
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.
Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
let(:allowed) { | ||
double(name: 'create_user', allowed?: true, roles: [double(title: 'Users')]) | ||
} | ||
let(:create_user_right) { double(name: 'create_user', allowed?: true, roles: [double(title: 'Users')]) } |
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.
Metrics/LineLength: Line is too long. [106/80]
context 'when rights from is a symbol' do | ||
specify do | ||
expect{controller.send(:authorize_action!)}.to( | ||
raise_error(CanCan::AccessDenied, 'You are not authorized to access this page.')) |
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.
Metrics/LineLength: Line is too long. [91/80]
Layout/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
|
||
context 'when rights from is a symbol' do | ||
specify do | ||
expect{controller.send(:authorize_action!)}.to( |
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.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space missing inside {.
Layout/SpaceInsideBlockBraces: Space missing inside }.
end | ||
|
||
describe 'private #authorize_action!' do | ||
let(:controller) { |
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.
Style/BlockDelimiters: Avoid using {...} for multi-line blocks.
|
||
it 'should not grant access to controller#action' do | ||
expect{controller.send(:authorize_action!)}.to( | ||
raise_error(CanCan::AccessDenied, 'You are not authorized to access this page.')) |
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.
Metrics/LineLength: Line is too long. [91/80]
Layout/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
NOTE - This is ontop of another PR - With this PR there should be no need to depend both on this gem and cancanright gem. Unfortunately when cancanright was created it was created with inter-dependency.