Module: Localite::Scopes::Etest
- Defined in:
- lib/localite/scopes.rb
Constant Summary collapse
Instance Method Summary collapse
- #test_empty_scopes ⇒ Object
- #test_more_scopes ⇒ Object
- #test_more_scopes_w_dots ⇒ Object
- #test_scope ⇒ Object
Instance Method Details
#test_empty_scopes ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/localite/scopes.rb', line 86 def test_empty_scopes r = [] Localite.current_scope.each("str.y") do |scoped| r << scoped end assert_equal %w(str.y), r end |
#test_more_scopes ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/localite/scopes.rb', line 66 def test_more_scopes Localite.scope("a", :b, "b") do r = [] Localite.current_scope.each("str") do |scoped| r << scoped end assert_equal %w(a.b.b.str a.b.str a.str str), r end end |
#test_more_scopes_w_dots ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/localite/scopes.rb', line 76 def test_more_scopes_w_dots Localite.scope("a", :b, "b.c.d") do r = [] Localite.current_scope.each("str.y") do |scoped| r << scoped end assert_equal %w(a.b.b.c.d.str.y a.b.str.y a.str.y str.y), r end end |
#test_scope ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/localite/scopes.rb', line 53 def test_scope scope = Scopes.new scope.push("a") scope.push("b") scope.push("b", "str") assert_equal %w(a b b str), scope assert_equal %w(a.b.b.str a.b.b a.b a), scope.instance_variable_get("@prebuilt").reverse assert_equal "a:b:b:str", scope.to_s assert_equal "\"a:b:b:str\"", scope.inspect end |