spec/models/menu_spec.rb in lolita-menu-0.1.6 vs spec/models/menu_spec.rb in lolita-menu-0.1.7

- old
+ new

@@ -4,11 +4,11 @@ describe "save whole tree" do it "should save tree for menu when array given" do menu=Menu.create!(:name=>"menu") - root=menu.root + root=menu.root(MenuItem) items=[] 1.upto(3) do |index| item=MenuItem.create!(:name=>"item-#{index}") items << menu.append(item) end @@ -42,15 +42,15 @@ :left => "4", :right=> "5" } } - menu.update_whole_tree(new_positions) - - menu.children.should have(1).item - menu.children.first.children.should have(1).item - menu.children.first.children.first.children.should have(1).item + MenuItem.update_whole_tree(new_positions, {:menu_id => menu.id}) + + menu.children(MenuItem).should have(1).item + menu.children(MenuItem).first.children.should have(1).item + menu.children(MenuItem).first.children.first.children.should have(1).item end end it "should create new menu item with name" do Menu.create!(:name=>"my menu").name.should == "my menu" @@ -65,13 +65,14 @@ describe "menu items" do let(:menu){Menu.create!(:name=>"new menu")} it "should create root item on create" do - menu.root.should_not be_nil + menu.root(MenuItem).should_not be_nil end it "should add new item to menu" do + debugger item=MenuItem.create!(:name=>"item",:url=>"/") menu.append(item) menu.items.should have(2).items end end