Sha256: e81fdfda957ae3ec0a60aa71cfa249f2b42b85fcf0c6a68356eca3d85c32b528

Contents?: true

Size: 1.39 KB

Versions: 343

Compression:

Stored size: 1.39 KB

Contents

#encoding: utf-8
require 'spec_helper'

module Gherkin
  module Lexer
    describe I18nLexer do
      before do
        @lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false)
      end

      it "should store the i18n language of the last scanned feature" do
        @lexer.scan("# language: fr\n")
        @lexer.i18n_language.iso_code.should == "fr"
        @lexer.scan("# language: no\n")
        @lexer.i18n_language.iso_code.should == "no"
      end

      it "should detect language when there are spaces and CRLF" do
        @lexer.scan("# language: da  \r\n")
        @lexer.i18n_language.iso_code.should == "da"
      end

      it "should detect language when the language comment is not the first line" do
        @lexer.scan("# hello\n# language: no\n")
        @lexer.i18n_language.iso_code.should == "no"
      end

      it "should detect language when the language is on the third line, and there are empty lines above" do
        @lexer.scan("# hello\n\n# language: no\n")
        @lexer.i18n_language.iso_code.should == "no"
      end

      it "should use English i18n by default" do
        @lexer.scan("Feature: foo\n")
        @lexer.i18n_language.iso_code.should == "en"
      end

      it "should === its ruby class, even when the impl is Java" do
        Gherkin::Lexer::I18nLexer.should === Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, true)
      end
    end
  end
end

Version data entries

343 entries across 338 versions & 10 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/gherkin-2.11.1/spec/gherkin/lexer/i18n_lexer_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/gherkin-2.11.1/spec/gherkin/lexer/i18n_lexer_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/gherkin-2.11.1/spec/gherkin/lexer/i18n_lexer_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.7 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.7-x86-mswin32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.7-x86-mingw32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.7-java spec/gherkin/lexer/i18n_lexer_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.6 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.6-x86-mswin32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.6-x86-mingw32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.6-java spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.5 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.5-x86-mswin32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.5-x86-mingw32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.5-java spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.4 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.4-x86-mswin32 spec/gherkin/lexer/i18n_lexer_spec.rb
gherkin-2.11.4-x86-mingw32 spec/gherkin/lexer/i18n_lexer_spec.rb