Sha256: 8501ebfb713be531a6beb0177bde8148dc79475180c755455258c4b46e732b13

Contents?: true

Size: 866 Bytes

Versions: 6

Compression:

Stored size: 866 Bytes

Contents

require 'yaml'
require 'json'
require 'cucumber/cucumber_expressions/cucumber_expression_tokenizer'
require 'cucumber/cucumber_expressions/errors'

module Cucumber
  module CucumberExpressions
    describe 'Cucumber expression tokenizer' do
      Dir['../testdata/tokens/*.yaml'].each do |testcase|
        expectation = YAML.load_file(testcase) # encoding?
        it "#{testcase}" do
          tokenizer = CucumberExpressionTokenizer.new
          if expectation['exception'].nil?
            tokens = tokenizer.tokenize(expectation['expression'])
            token_hashes = tokens.map{|token| token.to_hash}
            expect(token_hashes).to eq(JSON.parse(expectation['expected']))
          else
            expect { tokenizer.tokenize(expectation['expression']) }.to raise_error(expectation['exception'])
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-cucumber-expressions-14.0.0/spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb
cucumber-cucumber-expressions-14.0.0 spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb
cucumber-cucumber-expressions-13.1.3 spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb
cucumber-cucumber-expressions-13.1.2 spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb
cucumber-cucumber-expressions-13.1.1 spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb
cucumber-cucumber-expressions-13.1.0 spec/cucumber/cucumber_expressions/cucumber_expression_tokenizer_spec.rb