Sha256: e174b6da1c50cb1d371f1365d6885a83b1c1990c68f862fcd26b7f46b1b6a0b1

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

require 'test_helper'
require 'dslkit/polite'

class ScopeTest < Test::Unit::TestCase
  include DSLKit::Scope

  def test_default_scope
    scope_block(:foo) do
      assert_equal [ :foo ], scope
      scope_block(:bar) do
        assert_equal [ :foo, :bar ], scope
        scope.push :baz
        assert_equal [ :foo, :bar ], scope
      end
    end
  end

  def test_two_scopes
    scope_block(:foo, :my_scope) do
      assert_equal [ :foo ], scope(:my_scope)
      scope_block(:baz) do
        scope_block(:bar, :my_scope) do
          assert_equal [ :foo, :bar ], scope(:my_scope)
          scope.push(:baz, :my_scope)
          assert_equal [ :foo, :bar ], scope(:my_scope)
          assert_equal [ :baz ], scope
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dslkit-0.2.13 tests/scope_test.rb
dslkit-0.2.12 tests/scope_test.rb
dslkit-0.2.11 tests/scope_test.rb
dslkit-0.2.10 tests/scope_test.rb