Sha256: e5cf462641a36833ae2f908964722c878e53dc20b09b2275067acea21d68d2c7

Contents?: true

Size: 903 Bytes

Versions: 22

Compression:

Stored size: 903 Bytes

Contents

require 'rails_helper'

module Kuroko2::Workflow::Task
  describe SubProcess do
    let(:definition) { create(:job_definition) }
    let(:sub_definition) { create(:job_definition) }

    let(:instance) do
      create(:job_instance, job_definition: definition).tap do |instance|
        instance.tokens.first.destroy
      end
    end

    let(:node) { Kuroko2::Workflow::Node.new(:sub_process, sub_definition.id.to_s) }
    let(:token) { create(:token, job_definition: definition, job_instance: instance) }

    let(:sub_instance) { sub_definition.job_instances.first }

    describe '#execute' do
      subject(:task) { SubProcess.new(node, token) }

      it do
        expect(task.execute).to eq :pass
        expect(Kuroko2::Token.count).to eq 2
        expect(task.execute).to eq :pass

        sub_instance.touch(:finished_at)
        expect(task.execute).to eq :next
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kuroko2-0.8.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.7.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.6.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.5.2 spec/workflow/task/sub_process_spec.rb
kuroko2-0.5.1 spec/workflow/task/sub_process_spec.rb
kuroko2-0.5.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.6 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.5 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.4 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.3 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.2 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.1 spec/workflow/task/sub_process_spec.rb
kuroko2-0.4.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.3.4 spec/workflow/task/sub_process_spec.rb
kuroko2-0.3.3 spec/workflow/task/sub_process_spec.rb
kuroko2-0.3.2 spec/workflow/task/sub_process_spec.rb
kuroko2-0.3.1 spec/workflow/task/sub_process_spec.rb
kuroko2-0.3.0 spec/workflow/task/sub_process_spec.rb
kuroko2-0.2.3 spec/workflow/task/sub_process_spec.rb
kuroko2-0.2.2 spec/workflow/task/sub_process_spec.rb