Sha256: 5b4c42b0c32b99f3503606e949e87c49615e1b2d5c4f2171cd11f13bf5336666
Contents?: true
Size: 1.77 KB
Versions: 3
Compression:
Stored size: 1.77 KB
Contents
require File.expand_path('../../../../../helper', __FILE__) describe('Ramaze::Helper::Menu') do behaves_like :capybara extend Ramaze::Helper::Menu # Create all the required data menu = Menus::Model::Menu.create(:name => 'Spec menu') item = Menus::Model::MenuItem.create( :name => 'Spec item', :menu_id => menu.id, :url => '/' ) child = Menus::Model::MenuItem.create( :name => 'Spec item child', :menu_id => menu.id, :url => '/child', :parent_id => item.id ) sub_child = Menus::Model::MenuItem.create( :name => 'Spec item sub child', :menu_id => menu.id, :url => '/sub-child', :parent_id => child.id ) it('Validate a valid menu') do url = Menus::Controller::Menus.r(:edit, menu.id).to_s visit(url) current_path.should == url end it('Validate an invalid menu') do url = Menus::Controller::Menus.r(:edit, menu.id + 100).to_s index = Menus::Controller::Menus.r(:index).to_s visit(url) current_path.should == index end it('Validate a valid menu item') do url = Menus::Controller::MenuItems.r(:edit, menu.id, item.id).to_s visit(url) current_path.should == url end it('Validate an invalid menu item') do url = Menus::Controller::MenuItems.r(:edit, menu.id, item.id + 100).to_s index = Menus::Controller::MenuItems.r(:index, menu.id).to_s visit(url) current_path.should == index end it('Generate a navigation tree') do tree = menu_item_tree(menu.id) tree[nil].should == '--' tree[child.id].should == " #{child.name}" tree[sub_child.id].should == " #{sub_child.name}" end sub_child.destroy child.destroy item.destroy menu.destroy end # describe
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zen-0.3 | spec/zen/package/menus/helper/menu.rb |
zen-0.3b1 | spec/zen/package/menus/helper/menu.rb |
zen-0.3b | spec/zen/package/menus/helper/menu.rb |