Sha256: 2e4db6a2bdb3eb35ffe1e95f2396dfa8a940f55866c5686ae65519431b818dca

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 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

14 entries across 14 versions & 1 rubygems

Version Path
mini_kraken-0.2.04 spec/core/succeed_spec.rb
mini_kraken-0.2.03 spec/core/succeed_spec.rb
mini_kraken-0.2.02 spec/core/succeed_spec.rb
mini_kraken-0.2.01 spec/core/succeed_spec.rb
mini_kraken-0.2.00 spec/core/succeed_spec.rb
mini_kraken-0.1.13 spec/core/succeed_spec.rb
mini_kraken-0.1.12 spec/core/succeed_spec.rb
mini_kraken-0.1.11 spec/core/succeed_spec.rb
mini_kraken-0.1.10 spec/core/succeed_spec.rb
mini_kraken-0.1.09 spec/core/succeed_spec.rb
mini_kraken-0.1.08 spec/core/succeed_spec.rb
mini_kraken-0.1.07 spec/core/succeed_spec.rb
mini_kraken-0.1.06 spec/core/succeed_spec.rb
mini_kraken-0.1.05 spec/core/succeed_spec.rb