Sha256: e21ff88fe876fd14e3c3381c14bd3fc7534fdf97e7c663ff1fbe3498d16c3afc
Contents?: true
Size: 1.83 KB
Versions: 18
Compression:
Stored size: 1.83 KB
Contents
require 'rails_helper' module Kuroko2::Workflow::Task describe Queue do describe '#execute' do subject { token.context['QUEUE'] } let(:token) { build(:token, script: 'queue:') } let(:queue) { Kuroko2::Execution::DEFAULT_QUEUE } before do Kuroko2::Worker.create!(hostname: 'test', worker_id: 1, queue: queue, working: true) end context 'valid case' do before { Kuroko2::Workflow::Task::Queue.new(node, token).execute } context 'with default queue' do let(:node) { Kuroko2::Workflow::Node.new(:queue) } it { is_expected.to eq queue } end context 'with given queue' do let(:queue) { 'queue_name' } let(:node) { Kuroko2::Workflow::Node.new(:queue, queue) } it { is_expected.to eq queue } end end context 'with default queue' do let(:node) { Kuroko2::Workflow::Node.new(:queue, '@default') } it { expect { Kuroko2::Workflow::Task::Queue.new(node, token).validate }.not_to raise_error } end context 'with valid queue' do before { create(:worker, queue: 'myqueue') } let(:node) { Kuroko2::Workflow::Node.new(:queue, 'myqueue') } it { expect { Kuroko2::Workflow::Task::Queue.new(node, token).validate }.not_to raise_error } end context 'with invalid queue' do let(:node) { Kuroko2::Workflow::Node.new(:queue, '!invalid!') } it { expect { Kuroko2::Workflow::Task::Queue.new(node, token).validate }.to raise_error(Kuroko2::Workflow::AssertionError) } end context 'with no existance queue' do let(:node) { Kuroko2::Workflow::Node.new(:queue, 'invalid') } it { expect { Kuroko2::Workflow::Task::Queue.new(node, token).validate }.to raise_error(Kuroko2::Workflow::AssertionError) } end end end end
Version data entries
18 entries across 18 versions & 1 rubygems