Sha256: b80c91671b0f7bd68586a63395dd9d6cc6e8ece6da0f1ac26915891424f0e021

Contents?: true

Size: 839 Bytes

Versions: 6

Compression:

Stored size: 839 Bytes

Contents

require 'test/unit'
require 'rubygems'
require_gem 'rails'
require 'initializer'
begin
  require 'rails_info'
rescue 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

6 entries across 6 versions & 1 rubygems

Version Path
gettext-1.7.0-mswin32 test/gettext_test_rails.rb
gettext-1.6.0-mswin32 test/gettext_test_rails.rb
gettext-1.5.0-mswin32 test/gettext_test_rails.rb
gettext-1.5.0 test/gettext_test_rails.rb
gettext-1.7.0 test/gettext_test_rails.rb
gettext-1.6.0 test/gettext_test_rails.rb