Sha256: 8af0f6c0d1e1a546442accda3945bab19cd759a79f90c4049633776a59c5c7cc

Contents?: true

Size: 746 Bytes

Versions: 2

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'default option' do
  subject do
    StarGazer.new(hash).favorite_star
  end

  let(:hash) { {} }

  context 'when node is not found' do
    it 'returns the default before wrapping' do
      expect(subject.name).to eq('Sun')
    end

    it 'wraps the returned value in a class' do
      expect(subject).to be_a(Star)
    end
  end

  context 'when node is not missing' do
    let(:hash) do
      {
        universe: {
          star: { name: 'Antares' }
        }
      }
    end

    it 'returns the value before wrapping' do
      expect(subject.name).to eq('Antares')
    end

    it 'wraps the returned value in a class' do
      expect(subject).to be_a(Star)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arstotzka-1.0.3 spec/integration/readme/default_spec.rb
arstotzka-1.0.2 spec/integration/readme/default_spec.rb