Skip to content

Commit e0bb6b3

Browse files
committed
FIX: Add regression test
1 parent b21f5d1 commit e0bb6b3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/report_generator_spec.rb

+20
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,24 @@
253253
)
254254
end
255255
end
256+
257+
describe ".params_to_hash" do
258+
context "when passing nothing" do
259+
let(:query_params) { '[]' }
260+
261+
it { expect(described_class.params_to_hash(query_params)).to eq({}) }
262+
end
263+
264+
context "when passing an array of arrays" do
265+
let(:query_params) { '[["foo", 1], ["bar", 2]]' }
266+
267+
it { expect(described_class.params_to_hash(query_params)).to eq({ "foo" => 1, "bar" => 2 }) }
268+
end
269+
270+
context "when passing an array of hashes" do
271+
let(:query_params) { '[{ "key": "foo", "value": 1 }, { "key": "bar", "value": 2 }]' }
272+
273+
it { expect(described_class.params_to_hash(query_params)).to eq({ "foo" => 1, "bar" => 2 }) }
274+
end
275+
end
256276
end

0 commit comments

Comments
 (0)