Sha256: 91e76f4c1e0beb60d07d7dadd0b443bdb9fb1e463ffda28e8f1553cd0e4be52c

Contents?: true

Size: 855 Bytes

Versions: 19

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

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

    let(:hash) { {} }

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

      it 'wraps the returned value in a class' do
        expect(star_gazer).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(star_gazer.name).to eq('Antares')
      end

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
arstotzka-1.6.2 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.6.1 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.6.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.5.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.4.4 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.4.3 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.4.2 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.4.1 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.4.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.3.2 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.3.1 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.3.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.2.4 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.2.3 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.2.2 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.2.1 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.2.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.1.0 spec/integration/readme/arstotzka_spec.rb
arstotzka-1.0.4 spec/integration/readme/arstotzka_spec.rb