Sha256: 04fdc3e8fbc56ce43b0006e76a6f6cccecf6a1bdabd5ba99fa36d50ccff896a6

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

require 'yaml'
require 'cucumber/cucumber_expressions/cucumber_expression'
require 'cucumber/cucumber_expressions/parameter_type_registry'

module Cucumber
  module CucumberExpressions
    describe CucumberExpression do
      Dir['../testdata/cucumber-expression/transformation/*.yaml'].each do |path|
        expectation = YAML.load_file(path)
        it "transforms #{path}" do
          parameter_registry = ParameterTypeRegistry.new
          if expectation['exception']
            expect {
              cucumber_expression = CucumberExpression.new(expectation['expression'], parameter_registry)
              cucumber_expression.match(expectation['text'])
            }.to raise_error(expectation['exception'])
          else
            cucumber_expression = CucumberExpression.new(expectation['expression'], parameter_registry)
            matches = cucumber_expression.match(expectation['text'])
            values = matches.nil? ? nil : matches.map { |arg| arg.value(nil) }
            expect(values).to eq(expectation['expected_args'])
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-cucumber-expressions-16.1.2/spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-16.1.2 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-16.1.1 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-16.1.0 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-16.0.1 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-16.0.0 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-15.2.0 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-15.1.1 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-15.1.0 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-15.0.2 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb
cucumber-cucumber-expressions-15.0.1 spec/cucumber/cucumber_expressions/cucumber_expression_transformation_spec.rb