Sha256: 8975cbe961b3b680a318caad38d464851d867635073d0478e434caca3eb64098

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

require_relative "../spec_helper"

describe Kong::Util do
  describe '.flatten' do
    subject { described_class.method(:flatten) }

    it 'works' do
      expect(subject[{
        a: {
          b: 1,
          c: {
            d: 3
          }
        },
        b: 2
      }]).to include({
        "a.b" => 1,
        "a.c.d" => 3,
        "b" => 2,
      })
    end

    it 'accepts a scope' do
      expect(subject[{ a: "1" }, 'config']).to eq({
        "config.a" => "1"
      })
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
kong-client-0.4.0 spec/kong/util_spec.rb
kong-0.3.4 spec/kong/util_spec.rb
kong-0.3.3 spec/kong/util_spec.rb