Sha256: 90fd169d4e4586ad6801c4558c54e3b1110e65f23261f6582a769a0bcb9e671a
Contents?: true
Size: 1.45 KB
Versions: 22
Compression:
Stored size: 1.45 KB
Contents
require 'rails_helper' module Kuroko2::Workflow::Task describe Env do describe '#execute' do let(:token) { build(:token, script: 'env:', context: { 'ENV' => { 'EXISTING' => 'true' } }) } context 'with valid syntax' do before { Env.new(node, token).execute } subject { token.context } context 'with nil option' do let(:node) { Kuroko2::Workflow::Node.new(:env) } context 'with exisiting env' do it { is_expected.to eq({ 'ENV' => { 'EXISTING' => 'true' } }) } end context 'without exisiting env' do let(:token) { build(:token, script: 'env:') } it { is_expected.to eq({}) } end end context 'with valid option' do let(:node) { Kuroko2::Workflow::Node.new(:env, 'A=1 B=2') } it { is_expected.to eq({ 'ENV' => { 'A' => '1', 'B' => '2', 'EXISTING' => 'true' } }) } end context 'with quote' do let(:node) { Kuroko2::Workflow::Node.new(:env, 'A="B=2 C=3" D="E=5 F=\"6"' " G='\\'7'") } it { is_expected.to eq({ 'ENV' => { 'A' => 'B=2 C=3', 'D' => 'E=5 F="6', 'G' => "'7", 'EXISTING' => 'true' } }) } end end context 'with invalid syntax' do let(:node) { Kuroko2::Workflow::Node.new(:env, 'A="B=2 C=3" D="E=5 F=\"6') } it { expect { Env.new(node, token).execute }.to raise_error(Kuroko2::Workflow::AssertionError) } end end end end
Version data entries
22 entries across 22 versions & 1 rubygems