Sha256: 2029a9a66d4d32c4e0f7a780f92bd0d3399e75df70baad20ec5a7486656b1736

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

module CollectiveIdea
  module Acts #:nodoc:
    module NestedSet #:nodoc:
      class AwesomeNestedSetTest < Test::Unit::TestCase
        include Helper
        fixtures :categories
        
        def test_nested_set_options
          expected = [
            [" Top Level", 1],
            ["- Child 1", 2],
            ['- Child 2', 3],
            ['-- Child 2.1', 4],
            ['- Child 3', 5],
            [" Top Level 2", 6]
          ]
          actual = nested_set_options(Category) do |c|
            "#{'-' * c.level} #{c.name}"
          end
          assert_equal expected, actual
        end
        
        def test_nested_set_options_with_mover
          expected = [
            [" Top Level", 1],
            ["- Child 1", 2],
            ['- Child 3', 5],
            [" Top Level 2", 6]
          ]
          actual = nested_set_options(Category, categories(:child_2)) do |c|
            "#{'-' * c.level} #{c.name}"
          end
          assert_equal expected, actual
        end
        
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
collectiveidea-awesome_nested_set-1.1.1 test/awesome_nested_set/helper_test.rb
collectiveidea-awesome_nested_set-1.2.0 test/awesome_nested_set/helper_test.rb
ggoodale-awesome_nested_set-1.1.1 test/awesome_nested_set/helper_test.rb
ggoodale-awesome_nested_set-1.1 test/awesome_nested_set/helper_test.rb
shuber-awesome_nested_set-1.1.2 test/awesome_nested_set/helper_test.rb
shuber-awesome_nested_set-1.1.3 test/awesome_nested_set/helper_test.rb
shuber-awesome_nested_set-1.1.4 test/awesome_nested_set/helper_test.rb