Sha256: 5e62c7f6c2429bdeb47d21988f6e7c5889cfcb79b12c1124f0aef8d0db51ad6f
Contents?: true
Size: 1.68 KB
Versions: 15
Compression:
Stored size: 1.68 KB
Contents
require 'cucumber/cucumber_expressions/cucumber_expression' require 'cucumber/cucumber_expressions/parameter_type_registry' module Cucumber module CucumberExpressions describe CucumberExpression do context "Regexp translation" do def assert_regexp(expression, regexp) cucumber_expression = CucumberExpression.new(expression, ParameterTypeRegistry.new) expect(regexp).to eq(cucumber_expression.regexp) end it "translates no arguments" do assert_regexp( "I have 10 cukes in my belly now", /^I have 10 cukes in my belly now$/ ) end it "translates alternation" do assert_regexp( "I had/have a great/nice/charming friend", /^I (?:had|have) a (?:great|nice|charming) friend$/ ) end it "translates alternation with non-alpha" do assert_regexp( "I said Alpha1/Beta1", /^I said (?:Alpha1|Beta1)$/ ) end it "translates parameters" do assert_regexp( "I have {float} cukes at {int} o'clock", /^I have ((?=.*\d.*)[-+]?\d*(?:\.(?=\d.*))?\d*(?:\d+[E][-+]?\d+)?) cukes at ((?:-?\d+)|(?:\d+)) o'clock$/ ) end it "translates parenthesis to non-capturing optional capture group" do assert_regexp( "I have many big(ish) cukes", /^I have many big(?:ish)? cukes$/ ) end it "translates parenthesis with alpha unicode" do assert_regexp( "Привет, Мир(ы)!", /^Привет, Мир(?:ы)?!$/ ) end end end end end
Version data entries
15 entries across 15 versions & 2 rubygems