Sha256: c7f6638ce647165c79fb8adbcbdbaf1a44c19410dc1d23eaa81515f0ef42a1e7

Contents?: true

Size: 1.11 KB

Versions: 26

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'

module PushType
  module MenuBuilder
    class MenuItemTest < ActiveSupport::TestCase

      let(:item) { MenuBuilder::MenuItem.new :foo }

      it { item.key.must_equal :foo }
      it { item.text.must_equal 'Foo' }
      it { item.link.must_equal nil }
      it { item.active.must_equal false }
      it { item.element.must_equal :li }
      it { item.item_options.must_be_instance_of Hash }
      it { item.link_options.must_be_instance_of Hash }
      it { item.active_class.must_equal nil }

      describe '#submenu' do
        it 'should create a new menu' do
          item.submenu.must_be_instance_of MenuBuilder::Menu
        end
        it 'should use existing submenu if present' do
          menu = item.submenu
          item.submenu.must_equal menu
        end
      end

      describe '#validate!' do
        describe 'without all attributes' do
          it { proc { item.validate! }.must_raise RuntimeError }
        end
        describe 'with all attributes' do
          before { item.link = '/foobar' }
          it { item.validate!.must_equal true }
        end
      end

    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
push_type_core-0.10.0 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.10.0.beta.5 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.10.0.beta.3 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.5 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.3 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.2 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.1 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.0 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.0.beta.4 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.0.beta.3 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.9.0.beta.2 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.2 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.1 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.0 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.0.beta.3 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.0.beta.2 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.8.0.beta.1 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.7.0 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.7.0.beta.1 test/lib/push_type/menu_builder/menu_item_test.rb
push_type_core-0.6.0 test/lib/push_type/menu_builder/menu_item_test.rb