Sha256: 840a5c6600d990d8e656780019cba1a50d9bac63acb8c58b5afa0f6ce8eacabe

Contents?: true

Size: 1.66 KB

Versions: 22

Compression:

Stored size: 1.66 KB

Contents

#encoding: utf-8
require 'spec_helper'

module Gherkin
  module Lexer
    shared_examples_for "encoding" do
      describe "with BOM" do
        it "should work just fine" do
          scan_file("with_bom.feature")
          @listener.to_sexp.should == [
            [:feature, "Feature", "Feature Text", "", 1],
            [:scenario, "Scenario", "Reading a Scenario", "", 2],
            [:step, "Given ", "there is a step", 3],
            [:eof]
          ]
        end

        describe "and language specification" do
          it "should work just fine" do
            @lexer = Gherkin::Lexer::I18nLexer.new(@listener)
            scan_file("with_bom_and_language_spec.feature")
            @listener.to_sexp.should == [
              [:comment, "# language: nl", 1], 
              [:feature, "Functionaliteit", "Feature Text", "", 2],
              [:scenario, "Scenario", "Reading a Scenario", "", 3],
              [:step, "Gegeven ", "there is a step", 4],
              [:eof]
            ]
          end
        end

        describe "with ISO-8859-1 encoding" do
          it "should work just fine" do
            @lexer = Gherkin::Lexer::I18nLexer.new(@listener)
            scan_file("iso-8859-1.feature")
            @listener.to_sexp.should == [
              [:comment, "# language: no", 1], 
              [:comment, "# encoding: iSo-8859-1", 2],
              [:feature, "Egenskap", "ISO-8859-1", "", 3],
              [:scenario, "Scenario", "ÆØÅ", "", 4],
              [:step, "Når ", "this is encoded as Latin-1", 5],
              [:step, "Så ", "everything should parse", 6],
              [:eof]
            ]
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
gherkin-2.12.1 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.1-x86-mswin32 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.1-x86-mingw32 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.1-java spec/gherkin/shared/encoding_group.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/spec/gherkin/shared/encoding_group.rb
gherkin-2.12.0 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.0-x86-mingw32 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.0-x86-mswin32 spec/gherkin/shared/encoding_group.rb
gherkin-2.12.0-java spec/gherkin/shared/encoding_group.rb
gherkin-2.11.8 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.8-x86-mswin32 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.8-x86-mingw32 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.8-java spec/gherkin/shared/encoding_group.rb
gherkin-2.11.7 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.7-x86-mswin32 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.7-x86-mingw32 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.7-java spec/gherkin/shared/encoding_group.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/spec/gherkin/shared/encoding_group.rb
gherkin-2.11.6 spec/gherkin/shared/encoding_group.rb
gherkin-2.11.6-x86-mswin32 spec/gherkin/shared/encoding_group.rb