Sha256: 7667cbe45feedd052878f6ca8e673be9f1963ba8cce013986016be6f02547fcd

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require_relative '../spec_helper' # Use the RSpec framework

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

module MiniKraken
  module Core
    describe Succeed do
      subject { Succeed.instance }

      context 'Initialization:' do
        it 'should have one instance' do
          expect { Succeed.instance }.not_to raise_error
        end

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

      context 'Provided services:' do
        it 'should unconditionally return a success result' do
          args = double('fake-args')
          env = double('fake-env')
          
          solver = nil
          expect { solver = subject.solver_for(args, env) }.not_to raise_error
          
          # Solver should quack like a Fiber
          dummy_arg = double('dummy-stuff')
          result = solver.resume(dummy_arg)
          expect(result).to eq(BasicSuccess)
          
          # Only one "solution", next 'resume' call should return nil
          result = solver.resume(dummy_arg)
          expect(result).to be_nil          
        end
      end # context
    end # describe
  end # module
end # module

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mini_kraken-0.1.04 spec/core/succeed_spec.rb
mini_kraken-0.1.03 spec/core/succeed_spec.rb
mini_kraken-0.1.02 spec/core/succeed_spec.rb