Sha256: 874b2d36e1317173422b8b49878420a939cdfdd8b87711b9b080ce595dd38a43

Contents?: true

Size: 852 Bytes

Versions: 19

Compression:

Stored size: 852 Bytes

Contents

require 'test_helper'

class ExpanderStackTest < ActiveSupport::TestCase

  def new_stack
    ExpressTemplates::Expander::Stack.new
  end

  test "#current is empty" do
    assert_empty new_stack.current
  end

  test "#<< adds something to the current" do
    stack = new_stack
    stack << 'foo'
    assert_equal ['foo'], stack.current
  end

  test "#all returns the stack" do
    assert_equal [[]], new_stack.all
  end

  test "#descend! adds a level to the stack and updates current" do
    stack = new_stack
    stack << 'foo'
    level = stack.descend!
    assert_equal 2, stack.all.count
    assert_equal [], stack.current
    assert_equal 1, level
  end

  test "#ascend!" do
    stack = new_stack
    stack << 'foo'
    level_1 = stack.descend!
    level_2 = stack.descend!
    level = stack.ascend!
    assert_equal level_1, level
  end

end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
express_admin-1.2.1 vendor/gems/express_templates/test/expander_stack_test.rb
express_admin-1.2.0 vendor/gems/express_templates/test/expander_stack_test.rb
express_templates-0.5.0 test/expander_stack_test.rb
express_templates-0.4.2 test/expander_stack_test.rb
express_templates-0.4.1 test/expander_stack_test.rb
express_templates-0.4.0 test/expander_stack_test.rb
express_templates-0.3.6 test/expander_stack_test.rb
express_templates-0.3.5 test/expander_stack_test.rb
express_templates-0.3.4 test/expander_stack_test.rb
express_templates-0.3.2 test/expander_stack_test.rb
express_templates-0.3.1 test/expander_stack_test.rb
express_templates-0.3.0 test/expander_stack_test.rb
express_templates-0.2.7 test/expander_stack_test.rb
express_templates-0.2.6 test/expander_stack_test.rb
express_templates-0.2.5 test/expander_stack_test.rb
express_templates-0.2.4 test/expander_stack_test.rb
express_templates-0.2.3 test/expander_stack_test.rb
express_templates-0.2.2 test/expander_stack_test.rb
express_templates-0.2.0 test/expander_stack_test.rb