mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Rubocop: re-enable IndentHash rule
One advantage of sticking with the default rule is that it insulates us from naming changes: this cop is renamed in later versions of Rubocop.
This commit is contained in:
parent
ca44b39f30
commit
e39e1c5a81
2 changed files with 30 additions and 25 deletions
|
@ -90,8 +90,5 @@ Lint/HandleExceptions:
|
|||
Style/SpecialGlobalVars:
|
||||
Enabled: false
|
||||
|
||||
Layout/IndentHash:
|
||||
Enabled: false
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
|
|
@ -518,11 +518,13 @@ describe Pundit do
|
|||
|
||||
describe "#permitted_attributes" do
|
||||
it "checks policy for permitted attributes" do
|
||||
params = ActionController::Parameters.new(post: {
|
||||
title: "Hello",
|
||||
votes: 5,
|
||||
admin: true
|
||||
})
|
||||
params = ActionController::Parameters.new(
|
||||
post: {
|
||||
title: "Hello",
|
||||
votes: 5,
|
||||
admin: true
|
||||
}
|
||||
)
|
||||
|
||||
action = "update"
|
||||
|
||||
|
@ -534,11 +536,13 @@ describe Pundit do
|
|||
end
|
||||
|
||||
it "checks policy for permitted attributes for record of a ActiveModel type" do
|
||||
params = ActionController::Parameters.new(customer_post: {
|
||||
title: "Hello",
|
||||
votes: 5,
|
||||
admin: true
|
||||
})
|
||||
params = ActionController::Parameters.new(
|
||||
customer_post: {
|
||||
title: "Hello",
|
||||
votes: 5,
|
||||
admin: true
|
||||
}
|
||||
)
|
||||
|
||||
action = "update"
|
||||
|
||||
|
@ -554,24 +558,28 @@ describe Pundit do
|
|||
|
||||
describe "#permitted_attributes_for_action" do
|
||||
it "is checked if it is defined in the policy" do
|
||||
params = ActionController::Parameters.new(post: {
|
||||
title: "Hello",
|
||||
body: "blah",
|
||||
votes: 5,
|
||||
admin: true
|
||||
})
|
||||
params = ActionController::Parameters.new(
|
||||
post: {
|
||||
title: "Hello",
|
||||
body: "blah",
|
||||
votes: 5,
|
||||
admin: true
|
||||
}
|
||||
)
|
||||
|
||||
action = "revise"
|
||||
expect(Controller.new(user, action, params).permitted_attributes(post).to_h).to eq("body" => "blah")
|
||||
end
|
||||
|
||||
it "can be explicitly set" do
|
||||
params = ActionController::Parameters.new(post: {
|
||||
title: "Hello",
|
||||
body: "blah",
|
||||
votes: 5,
|
||||
admin: true
|
||||
})
|
||||
params = ActionController::Parameters.new(
|
||||
post: {
|
||||
title: "Hello",
|
||||
body: "blah",
|
||||
votes: 5,
|
||||
admin: true
|
||||
}
|
||||
)
|
||||
|
||||
action = "update"
|
||||
expect(Controller.new(user, action, params).permitted_attributes(post, :revise).to_h).to eq("body" => "blah")
|
||||
|
|
Loading…
Add table
Reference in a new issue