Sha256: 044af5f450066fc139308ca3726f359602564aca70f83a5e6956238dc84b9398

Contents?: true

Size: 654 Bytes

Versions: 12

Compression:

Stored size: 654 Bytes

Contents

RSpec.describe Evil::Client::Formatter::Form do
  subject { described_class.call value }

  context "when value is a hash" do
    let(:value) { { foo: { bar: [baz: :qux], qux: [1, 2] } } }

    it "returns formatted string" do
      expect(subject).to eq "foo[bar][][baz]=qux&foo[qux][]=1&foo[qux][]=2"
    end
  end

  context "when value is nil" do
    let(:value) { nil }

    it "returns nil" do
      expect(subject).to be_nil
    end
  end

  context "when value is not a hash" do
    let(:value) { 844 }

    it "raises Evil::Client::DefinitionError" do
      expect { subject }.to raise_error StandardError, "844 is not a hash"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
evil-client-3.2.0 spec/unit/formatter/form_spec.rb
evil-client-3.1.0 spec/unit/formatter/form_spec.rb
evil-client-3.0.4 spec/unit/formatter/form_spec.rb
evil-client-3.0.3 spec/unit/formatter/form_spec.rb
evil-client-3.0.2 spec/unit/formatter/form_spec.rb
evil-client-3.0.1 spec/unit/formatter/form_spec.rb
evil-client-3.0.0 spec/unit/formatter/form_spec.rb
evil-client-2.1.1 spec/unit/formatter/form_spec.rb
evil-client-2.1.0 spec/unit/formatter/form_spec.rb
evil-client-2.0.0 spec/unit/formatter/form_spec.rb
evil-client-1.1.0 spec/unit/formatter/form_spec.rb
evil-client-1.0.0 spec/unit/formatter/form_spec.rb