Sha256: 3f4814d5d8e107c6b74e88668239eb77556fa6d3ba772fa90f7f512f36e767c4
Contents?: true
Size: 1.14 KB
Versions: 21
Compression:
Stored size: 1.14 KB
Contents
RSpec.describe Card::Set::All::RichHtml::FormElements do describe "#hidden_tags" do def hidden_tags opts Card["A"].format.hidden_tags opts end example "simple argument" do expect(hidden_tags(a: "val")) .to have_tag :input, with: { type: "hidden", name: "a", value: "val" } end example "deep nested arguments" do tags = hidden_tags(a: { b: { c: "val1" }, d: "val2" }, x: { y: "val3" } ) expect(tags) .to have_tag(:input, with: { type: "hidden", name: "a[b][c]", value: "val1" }) expect(tags) .to have_tag(:input, with: { type: "hidden", name: "a[d]", value: "val2" }) expect(tags) .to have_tag(:input, with: { type: "hidden", name: "x[y]", value: "val3" }) end describe "array values" do let(:tags) { hidden_tags(a: { b: [1, 2] }) } example "first array value" do expect(tags) .to have_tag(:input, with: { type: "hidden", name: "a[b][]", value: "1" }) end example "second array value" do expect(tags) .to have_tag(:input, with: { type: "hidden", name: "a[b][]", value: "2" }) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems