Sha256: 2b5e4472a40ab290decd24bdf95b322692d4a7a26cdef2c31b9eb51a83f7906e
Contents?: true
Size: 1.45 KB
Versions: 10
Compression:
Stored size: 1.45 KB
Contents
require 'gherkin' require 'stringio' require 'gherkin/sexp_recorder' require 'gherkin/output_stream_string_io' require 'rubygems' require 'rspec/autorun' require 'gherkin/shared/lexer_group' require 'gherkin/shared/tags_group' require 'gherkin/shared/py_string_group' require 'gherkin/shared/row_group' module GherkinSpecHelper # TODO: Rename to gherkin_scan_file def scan_file(file) @lexer.scan(File.new(File.dirname(__FILE__) + "/gherkin/fixtures/" + file).read, file, 0) end # TODO: Remove def parse_file(file) @parser.parse(File.new(File.dirname(__FILE__) + "/gherkin/fixtures/" + file).read) end def rubify_hash(hash) if defined?(JRUBY_VERSION) h = {} hash.keySet.each{|key| h[key] = hash[key]} h else hash end end end RSpec.configure do |c| c.include(GherkinSpecHelper) end # Allows comparison of Java List with Ruby Array (rows) RSpec::Matchers.define :r do |expected| match do |row| def row.inspect "r " + self.map{|cell| cell}.inspect end row.map{|cell| cell}.should == expected end end RSpec::Matchers.define :a do |expected| match do |array| def array.inspect "a " + self.map{|e| e.to_sym}.inspect end array.map{|e| e.to_sym}.should == expected end end RSpec::Matchers.define :sym do |expected| match do |actual| expected.to_s == actual.to_s end end RSpec::Matchers.define :allow do |event| match do |parser| parser.expected.index(event) end end
Version data entries
10 entries across 10 versions & 1 rubygems