📄 view_picking_test.rb
字号:
require File.dirname(__FILE__) + '/test_helper'
class ViewPickingTest < Test::Unit::TestCase
include Globalize
fixtures :globalize_languages, :globalize_countries
class TestController < ActionView::Base
end
def setup
Locale.set("en-US")
@base_path = File.dirname(__FILE__) + '/views'
end
def test_first
tc = TestController.new
tc.base_path = @base_path
assert_match /English/, tc.render("test")
assert_no_match /Hebrew/, tc.render("test")
Locale.set("he-IL")
assert_match /Hebrew/, tc.render("test")
assert_no_match /English/, tc.render("test")
end
def test_non_full_path
tc = TestController.new
tc.base_path = @base_path
assert_match /English/, tc.render_file("#{@base_path}/test.rhtml", false)
end
def test_nil
Locale.set(nil)
tc = TestController.new
tc.base_path = @base_path
assert_match /English/, tc.render("test")
assert_no_match /Hebrew/, tc.render("test")
Locale.set("he-IL")
assert_match /Hebrew/, tc.render("test")
assert_no_match /English/, tc.render("test")
end
def test_non_full_path_nil
Locale.set(nil)
tc = TestController.new
tc.base_path = @base_path
assert_match /English/, tc.render_file("#{@base_path}/test.rhtml", false)
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -