Sha256: ab0d1456e3fbbff79f1c25c633730a2b2ce8fbb48df54acd8c8f1fe513d351a5

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe SimpleNavigation::Renderer::Text do

  describe 'render' do

    def render(current_nav=nil, options={:level => :all})
      primary_navigation = primary_container
      select_item(current_nav)
      setup_renderer_for SimpleNavigation::Renderer::Text, :rails, options
      @renderer.render(primary_navigation)
    end
    context 'regarding result' do

      it "should render the selected page" do
        render(:invoices).should == "invoices"
      end

      context 'nested sub_navigation' do
        it "should add an entry for each selected item" do
          render(:subnav1).should == "invoices subnav1"
        end
      end

      context 'with a custom seperator specified' do
        it "should separate the items with the separator" do
          render(:subnav1, :join_with => " | ").should == "invoices | subnav1" 
        end
      end
      
      context 'custom name generator is set' do
        before(:each) do
          SimpleNavigation.config.name_generator = Proc.new {|name| "<span>name</span>"}
        end
        it "should not apply the name generator (since it is text only)" do
          render(:subnav1, :join_with => " | ").should == "invoices | subnav1" 
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simple-navigation-3.5.0 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.4.2 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.4.1 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.4.0 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.3.4 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.3.3 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.3.2 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.3.1 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.3.0 spec/lib/simple_navigation/rendering/renderer/text_spec.rb
simple-navigation-3.2.0 spec/lib/simple_navigation/rendering/renderer/text_spec.rb