Sha256: 51e525a00ae7ee504fde9023f7361d412dc58e4c6e3d7d0d7dddfa25205557e7

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::Settable::Caster do
  describe '#yard' do
    describe 'altering base caster' do
      subject(:settable) { MathEnvSettings }

      before do
        ENV['MATH_VALUE'] = '80'
      end

      after do
        ENV.delete('MATH_VALUE')
      end

      it 'retrieves data from env' do
        expect(settable.value).to eq(6400.0)
      end
    end

    describe 'creating a new caster' do
      subject(:settable) { JsonEnvSettings }

      let(:hash) { { key: 'value' } }

      before do
        ENV['JSON_CONFIG'] = hash.to_json
      end

      after do
        ENV.delete('JSON_CONFIG')
      end

      it 'retrieves data from env' do
        expect(settable.config).to eq(hash.stringify_keys)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/integration/yard/sinclair/settable/caster_spec.rb
sinclair-2.1.0 spec/integration/yard/sinclair/settable/caster_spec.rb