# encoding: UTF-8 require 'spec_helper' require 'action_dispatch' require 'bh/helpers/nav_helper' include Bh::NavHelper describe 'nav' do let(:html) { nav options, &block } let(:block) { Proc.new {} } let(:options) { {} } describe 'with the :as option' do specify 'not set, shows a "tabs" nav' do expect(html).to include 'ul class="nav nav-tabs" role="tablist"' end context 'set to :tabs, shows a "tabs" nav' do let(:options) { {as: :tabs} } it { expect(html).to include 'ul class="nav nav-tabs"' } end context 'set to :pills, shows a "tabs" nav' do let(:options) { {as: :pills} } it { expect(html).to include 'ul class="nav nav-pills"' } end end describe 'with the :layout option' do specify 'not set, does not set a layout' do expect(html).to include 'ul class="nav nav-tabs" role="tablist"' end context 'set to :justified, shows a "justified" nav' do let(:options) { {layout: :justified} } it { expect(html).to include 'nav-justified' } end context 'set to :stacked, shows a "stacked" nav' do let(:options) { {layout: :stacked} } it { expect(html).to include 'nav-stacked' } end end describe 'given a +link_to+ in the content' do let(:block) { Proc.new { link_to 'Home', url} } let(:url) { '/any-page' } let(:request) { ActionDispatch::Request.new request_options } let(:request_options) { {'REQUEST_METHOD' => 'GET'} } specify 'surrounds the link in a list item' do expect(html).to include '