Sha256: 189cbe4e769f4c960620d6def3e00fef155be00913fc715ec02fb2614e0bf1d5

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

describe '#load_from_self => format: :json' do
  specify ':json-format support' do
    class JsonEndDataConfig < Qonfig::DataSet
      load_from_self format: :json
    end

    config = JsonEndDataConfig.new

    expect(config.settings.credentials.user).to eq('admin')
    expect(config.settings.credentials.password).to eq('123')
    expect(config.settings.credentials.enabled).to eq(true)
    expect(config.settings.amount).to eq(123.456)
    expect(config.settings.data).to eq(nil)
    expect(config.settings.methods).to eq([1, 'test', nil, true, false, ['data']])
  end
end

__END__

{
  "credentials": {
    "user": "admin",
    "password": "123",
    "enabled": true
  },
  "amount": 123.456,
  "data": null,
  "methods": [1, "test", null, true, false, ["data"]]
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qonfig-0.28.0 spec/features/load_from_self/format_option_json_spec.rb
qonfig-0.27.0 spec/features/load_from_self/format_option_json_spec.rb
qonfig-0.26.0 spec/features/load_from_self/format_option_json_spec.rb