Sha256: 2b4100bfde382a78eaec13dc7143918c50d65b10f52afc40546f1f6997cdd856

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require 'spec_helper'

describe NationBuilder::Utils::QueryParams do
  describe ".encode" do
    context "nested hash" do
      it "formats to proper url params hash" do
        expect(
          described_class.encode({ first: { second: { third: "value" } } })
        ).to eq({ "first[second][third]" => "value" })
      end
    end

    context "array" do
      it "formats to proper url params hash" do
        expect(described_class.encode(["tag"])).to eq({ "[]" => "tag" })
      end
    end

    context "nil" do
      it "formats to proper url params hash" do
        expect(described_class.encode(nil)).to eq({})
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nationbuilder-rb-1.6.2 spec/lib/nationbuilder/utils_spec.rb