require 'spec_helper' describe Locomotive::Liquid::Tags::Nav do before(:each) do @home = Factory.build(:page) @home.stubs(:children).returns([ Page.new(:title => 'Child #1', :fullpath => 'child_1', :slug => 'child_1'), Page.new(:title => 'Child #2', :fullpath => 'child_2', :slug => 'child_2') ]) @home.children.last.stubs(:children).returns([ Page.new(:title => 'Child #2.1', :fullpath => 'child_2/sub_child_1', :slug => 'sub_child_1'), Page.new(:title => 'Child #2.2', :fullpath => 'child_2/sub_child_2', :slug => 'sub_child_2') ]) @site = Factory.build(:site) @site.stubs(:pages).returns([@home]) end context '#rendering' do it 'renders from site' do render_nav.should == '' end it 'renders from page' do (page = @home.children.last.children.first).stubs(:parent).returns(@home.children.last) output = render_nav 'page', { :page => page } output.should == '' end it 'adds an icon before the link' do render_nav('site', {}, 'icon: true').should match /