Sha256: ee81dd24f9c25c5b03cf44c80b2740ffb6219a10575bb51dbe451a1bcf2c0bf2
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
require 'cucumber/create_meta' describe 'Cucumber::CreateMeta::VariableExpression.evaluate' do include Cucumber::CreateMeta::VariableExpression it 'returns nil when a variable is undefined' do expression = "hello-${SOME_VAR}"; result = evaluate(expression, {}); expect(result).to eq(nil) end it 'gets a value without replacement' do expression = "${SOME_VAR}"; result = evaluate(expression, {'SOME_VAR' => 'some_value'}); expect(result).to eq('some_value') end it 'captures a group' do expression = "${SOME_REF/refs\/heads\/(.*)/\\1}"; result = evaluate(expression, {'SOME_REF' => 'refs/heads/main'}); expect(result).to eq('main') end it 'works with star wildcard in var' do expression = "${GO_SCM_*_PR_BRANCH/.*:(.*)/\\1}"; result = evaluate(expression, {'GO_SCM_MY_MATERIAL_PR_BRANCH' => 'ashwankthkumar:feature-1'}); expect(result).to eq('feature-1') end it 'evaluates a complex expression' do expression = "hello-${VAR1}-${VAR2/(.*) (.*)/\\2-\\1}-world"; result = evaluate(expression, { 'VAR1' => 'amazing', 'VAR2' => 'gorgeous beautiful' }) expect(result).to eq('hello-amazing-beautiful-gorgeous-world') end end
Version data entries
7 entries across 7 versions & 2 rubygems