Sha256: 27560a436d2268aca60b8da358efa120a16764d7b0e5dd21ee16087ab842990d
Contents?: true
Size: 874 Bytes
Versions: 7
Compression:
Stored size: 874 Bytes
Contents
require 'spec_helper' module Refinery describe Menu do let(:menu) do page1 = FactoryGirl.create(:page, :title => 'test1') page2 = FactoryGirl.create(:page, :title => 'test2', :parent_id => page1.id) Refinery::Menu.new([page1, page2]) end describe '.initialize' do it "returns a collection of menu item objects" do menu.each { |item| item.should be_an_instance_of(MenuItem) } end end describe '#items' do it 'returns a collection' do menu.items.count.should eq(2) end end describe '#roots' do it 'returns a collection of items with parent_id == nil' do menu.roots.collect(&:parent_id).should eq([nil]) end end describe '#to_s' do it 'returns string of joined page titles' do menu.to_s.should eq('test1 test2') end end end end
Version data entries
7 entries across 7 versions & 1 rubygems