]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/globalize2/test/translation_test.rb
Merge branch 'master' into openstreetbugs
[rails.git] / vendor / plugins / globalize2 / test / translation_test.rb
1 require File.join( File.dirname(__FILE__), 'test_helper' )
2 require 'globalize/translation'
3
4 class TranslationTest < ActiveSupport::TestCase
5   include Globalize
6    
7   def setup
8     @translation = Translation::Static.new 'foo', :locale => :'en-US'
9   end
10
11   test "responds to fallback?" do
12     assert @translation.respond_to?( :fallback? )
13   end
14
15   test "returns true when :locale and :requested_locale are not equal" do
16     @translation.requested_locale = :'de-DE'
17     assert @translation.fallback?
18   end
19   
20   test "returns false when :locale and :requested_locale are equal" do
21     @translation.requested_locale = :'en-US'
22     assert !@translation.fallback?
23   end
24     
25   test "has the attribute :locale" do
26     assert @translation.respond_to?( :locale )
27   end
28   
29   test "has the attribute :requested_locale" do
30     assert @translation.respond_to?( :requested_locale )
31   end
32   
33   test "has the attribute :options" do
34     assert @translation.respond_to?( :options )
35   end
36   
37   test "has the attribute :plural_key" do
38     assert @translation.respond_to?( :plural_key )
39   end
40   
41   test "has the attribute :original" do
42     assert @translation.respond_to?( :original )    
43   end
44   
45   test "Translation::Attribute has the attribute :locale" do
46     translation = Translation::Attribute.new 'foo'
47     assert translation.respond_to?( :locale )
48   end
49   
50   test "Translation::Attribute has the attribute :requested_locale" do
51     translation = Translation::Attribute.new 'foo'
52     assert translation.respond_to?( :requested_locale )
53   end
54 end