Sha256: bd8afe5ed038077902927f7a27045c3d47efa348e14f2f0978714ca4561b3ebc

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

require 'test/unit'
require 'rubygems'
require_gem 'rails'
require 'initializer'
begin
  require 'rails_info'
rescue Gem::Exception
  module Rails
    module Info
      module_function
      def property(name, &block)
	
      end
    end
  end
end
require 'gettext/rails'
require 'stringio'

class TestRails < Test::Unit::TestCase
  def setup_cgi(str)
    $stdin = StringIO.new(str)
    cgi = CGI.new
    Locale.cgi = cgi
  end

  def test_bindtextdomain
    #query string
    Locale.default = Locale::Object.new("ja_JP.UTF-8")
    GetText.locale = "fr"
    GetText.bindtextdomain("test1", "locale")
    assert_equal("french", GetText._("language"))
    setup_cgi("lang=ja_JP")
    ENV["HTTP_ACCEPT_LANGUAGE"] = "ja,en-us;q=0.7,en;q=0.3"
    GetText.bindtextdomain("test1", "locale")
    assert_equal("french", GetText._("language"))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gettext-1.4.0-mswin32 test/gettext_test_rails.rb
gettext-1.4.0 test/gettext_test_rails.rb