Sha256: 24db0ab086c38e4e963fbc16a02419bf84e272e1209484e6b4e14d3d43f0c49e
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper_without_rails' require 'active_admin/menu' require 'active_admin/menu_item' include ActiveAdmin describe ActiveAdmin::Menu do context "with no items" do it "should have an empty item collection" do menu = Menu.new menu.items.should be_empty end it "should accept new items" do menu = Menu.new item = MenuItem.new menu.add item menu.items.first.should == item end end context "with many item" do let(:menu) do Menu.new do |m| m.add MenuItem.new(:label => "Dashboard") m.add MenuItem.new(:label => "Blog") end end it "should give access to the menu item as an array" do menu['Dashboard'].label.should == 'Dashboard' end end describe Menu::ItemCollection do let(:collection) { Menu::ItemCollection.new } it "should initialize" do collection.should be_empty end describe "#find_by_id" do let(:menu_item) { MenuItem.new(:id => "an_id") } before do collection.push menu_item end it "retrieve an item id" do MenuItem.should_receive(:generate_item_id).with("an_id").and_return("an_id") collection.find_by_id("an_id").should == menu_item end it "returns nil when no matching ids" do collection.find_by_id("not matching").should == nil end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-0.5.1 | spec/unit/menu_spec.rb |
activeadmin-0.5.0 | spec/unit/menu_spec.rb |
activeadmin-0.5.0.pre1 | spec/unit/menu_spec.rb |
activeadmin-0.5.0.pre | spec/unit/menu_spec.rb |