Sha256: 77377d164dbe99d7d6bd20f42bb7e09bc29dbcc5c9b4695c74e409780bf2f5d3
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
require 'spec_helper' require 'wordlist/lexer/lang' describe Wordlist::Lexer::Lang do describe ".default" do subject { described_class } context "when LANG is set" do context "and is of the form xx" do let(:env) { {'LANG' => 'xx'} } before { stub_const('ENV', env) } it "must return xx as a Symbol" do expect(subject.default).to be(:xx) end end context "and is of the form xx_YY" do let(:env) { {'LANG' => 'xx_YY'} } before { stub_const('ENV', env) } it "must return xx as a Symbol" do expect(subject.default).to be(:xx) end end context "and is of the form xx_YY.UTF-8" do let(:env) { {'LANG' => 'xx_YY.UTF-8'} } before { stub_const('ENV', env) } it "must return xx as a Symbol" do expect(subject.default).to be(:xx) end end context "and is of the form C.UTF-8" do let(:env) { {'LANG' => 'C.UTF-8'} } before { stub_const('ENV', env) } it "must return :en" do expect(subject.default).to be(:en) end end end context "when LANG is C" do let(:env) { {'LANG' => 'C'} } before { stub_const('ENV', env) } it "must default to :en" do expect(subject.default).to be(:en) end end context "when LANG is not set" do let(:env) { {} } before { stub_const('ENV', env) } it "must default to :en" do expect(subject.default).to be(:en) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems