Sha256: c031a8319e8e4250f95441217b5a749fb14a09521369ab5ca92f036ace173fb6

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require_relative '../spec_helper' # Use the RSpec framework
require_relative '../../lib/mini_kraken/core/vocabulary'

# Load the class under test
require_relative '../../lib/mini_kraken/core/outcome'

module MiniKraken
  module Core
    describe Outcome do
      let(:voc) do
        obj = Object.new
        obj.extend(Vocabulary)
        obj
      end
      subject { Outcome.new(:"#s", voc) }

      context 'Initialization:' do
        it 'should be created with a symbol and a vocabulary' do
          expect { Outcome.new(:"#s", voc) }.not_to raise_error
        end

        it 'should know its resultant' do
          expect(subject.resultant).to eq(:"#s")
        end

        it 'should know its parent' do
          expect(subject.parent).to eq(voc)
        end
      end # context

      context 'Provided services:' do
        it 'should have a factory for failing outcome' do
          instance = Outcome.failure(voc)
          expect(instance.resultant).to eq(:"#u")
          expect(instance.parent).to eq(voc)
        end

        it 'should have a factory for succeeding outcome' do
          instance = Outcome.success(voc)
          expect(instance.resultant).to eq(:"#s")
          expect(instance.parent).to eq(voc)
        end
      end # context
    end # describe
  end # module
end # module

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mini_kraken-0.2.02 spec/core/outcome_spec.rb
mini_kraken-0.2.01 spec/core/outcome_spec.rb
mini_kraken-0.2.00 spec/core/outcome_spec.rb
mini_kraken-0.1.13 spec/core/outcome_spec.rb
mini_kraken-0.1.12 spec/core/outcome_spec.rb
mini_kraken-0.1.11 spec/core/outcome_spec.rb
mini_kraken-0.1.10 spec/core/outcome_spec.rb