Skip to content

Commit 2df990d

Browse files
Add a spec that makes the alternative fix fail
1 parent 2205f86 commit 2df990d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/unit/resource_controller_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,19 @@ def call_after_destroy(obj); end
244244
end
245245
end
246246

247+
describe "when params batch_action matches existing BatchAction and form inputs defined" do
248+
let(:batch_action) { ActiveAdmin::BatchAction.new :flag, "Flag", form: { type: ["a", "b"] }, &batch_action_block }
249+
250+
let(:http_params) do
251+
{ batch_action: "flag", collection_selection: ["1"], batch_action_inputs: '{ "type": "a", "bogus": "param" }' }
252+
end
253+
254+
it "should filter permitted params" do
255+
expect(controller).to receive(:instance_exec).with(["1"], { "type" => "a" })
256+
controller.batch_action
257+
end
258+
end
259+
247260
describe "when params batch_action doesn't match a BatchAction" do
248261
let(:http_params) do
249262
{ batch_action: "derp", collection_selection: ["1"] }

0 commit comments

Comments
 (0)