Sha256: 254d5f5e39712f15ba80a3fa1cc3e0d01b2d1995ca22ae17404347adcdb74350

Contents?: true

Size: 1.53 KB

Versions: 101

Compression:

Stored size: 1.53 KB

Contents

if RUBY_VERSION =~ /1.9/
  Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
end

require 'rubygems'
require 'bundler'
Bundler.setup

require 'rspec'
require 'gherkin'
require 'stringio'
require 'gherkin/sexp_recorder'
require 'gherkin/output_stream_string_io'
require 'gherkin/shared/bom_group'
require 'gherkin/shared/lexer_group'
require 'gherkin/shared/tags_group'
require 'gherkin/shared/doc_string_group'
require 'gherkin/shared/row_group'
$:.unshift(File.dirname(__FILE__))

module GherkinSpecHelper
  def scan_file(file)
    @lexer.scan(fixture(file))
  end

  def fixture(file)
    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

101 entries across 98 versions & 8 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/1.8/gems/gherkin-2.11.1/spec/spec_helper.rb
candlepin-api-0.4.0 bundle/ruby/gems/gherkin-2.11.1/spec/spec_helper.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/gherkin-2.11.1/spec/spec_helper.rb
gherkin-2.11.3 spec/spec_helper.rb
gherkin-2.11.3-x86-mswin32 spec/spec_helper.rb
gherkin-2.11.3-x86-mingw32 spec/spec_helper.rb
gherkin-2.11.3-java spec/spec_helper.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/gherkin-2.11.1/spec/spec_helper.rb
gherkin-2.11.2 spec/spec_helper.rb
gherkin-2.11.2-x86-mswin32 spec/spec_helper.rb
gherkin-2.11.2-x86-mingw32 spec/spec_helper.rb
gherkin-2.11.2-java spec/spec_helper.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/gherkin-2.11.1/spec/spec_helper.rb
bryanl-gherkin-2.11.1.1-java spec/spec_helper.rb
bryanl-gherkin-2.11.1.1 spec/spec_helper.rb
gherkin-2.11.1 spec/spec_helper.rb
gherkin-2.11.1-x86-mswin32 spec/spec_helper.rb
gherkin-2.11.1-x86-mingw32 spec/spec_helper.rb
gherkin-2.11.1-java spec/spec_helper.rb
gherkin-2.11.0 spec/spec_helper.rb