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:
Duncan Stuart 2019-08-12 13:28:33 +02:00
parent ca44b39f30
commit e39e1c5a81
2 changed files with 30 additions and 25 deletions

View File

@ -90,8 +90,5 @@ Lint/HandleExceptions:
Style/SpecialGlobalVars:
Enabled: false
Layout/IndentHash:
Enabled: false
Style/DoubleNegation:
Enabled: false

View File

@ -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")