Sha256: cc7f57093ca6818f04f3ee56f862884db56c457db469d7e4ccaed4f133199a5a

Contents?: true

Size: 1.15 KB

Versions: 50

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

module Components

  class ModuleSidebarTest < ActiveSupport::TestCase

    class MenuItem
      attr_accessor :title, :path, :items

      def initialize(title, path, items)
        @title = title
        @path = path
        @items = items
      end
    end

    def rendered_module_sidebar
      arbre {
        module_sidebar
      }
    end

    def helpers
      mock_action_view do
        def foo_path ; "foo" ; end
        def bar_path ; "bar" ; end
        def baz_path ; "baz" ; end
        def current_menu
          MenuItem.new('Big Menu', 'menu_path', [
                          MenuItem.new('Foo', 'foo_path',[]),
                          MenuItem.new('Bar', 'bar_path', []),
                          MenuItem.new('Baz', 'baz_path', [])])
        end
        def current_menu_name
          current_menu.title
        end

      end
    end

    test "renders the correct current menu name as sidebar title" do
      assert_match /class="title">Big Menu/, rendered_module_sidebar
    end

    test "evals the correct path" do
      assert_equal "foo", helpers.instance_eval(helpers.current_menu.items.first.path)
    end

  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
express_admin-2.0.0.b test/dummy/test/components/module_sidebar_test.rb
express_admin-2.0.0.a test/dummy/test/components/module_sidebar_test.rb
express_admin-1.8.1 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.8.0 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.32 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.31 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.30 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.29 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.28 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.27 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.26 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.25 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.24 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.23 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.22 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.21 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.20 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.19 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.18 test/dummy/test/components/module_sidebar_test.rb
express_admin-1.7.17 test/dummy/test/components/module_sidebar_test.rb