Sha256: 5dec8b0a2e4bf7f46bac3eefafb43570dafae09ab10cbe8ce13b218584d74a10

Contents?: true

Size: 854 Bytes

Versions: 5

Compression:

Stored size: 854 Bytes

Contents

require "spec_helper"
require "action_view"

RSpec.describe Fume::Nav::HelperExt do
  class TestView < ::ActionView::Base
    include Fume::Nav::HelperExt
  end

  let(:controller) { ActionView::TestCase::TestController.new }
  let(:view) { TestView.new }
  before { view.output_buffer = ActionView::OutputBuffer.new }

  describe "#fume_nav" do
    let(:current) { :foo }
    subject { view.fume_nav(current) { |n| n.li_tag(:foo) { "foo" } } }
    it { is_expected.to include('<li class="active">foo</li>') }

    context "then hide_if_empty is true" do
      subject { view.fume_nav(current, hide_if_empty: true) { |n| "hide" } }
      it { is_expected.to eq nil }
    end

    context "then hide_if_empty is true" do
      subject { view.fume_nav(current, hide_if_empty: false) { |n| "show" } }
      it { is_expected.to eq "show" }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fume-nav-0.1.3 spec/fume/nav/helper_ext_spec.rb
fume-nav-0.1.2 spec/fume/nav/helper_ext_spec.rb
fume-nav-0.1.1 spec/fume/nav/helper_ext_spec.rb
fume-nav-0.1.0 spec/fume/nav/helper_ext_spec.rb
fume-nav-0.0.3 spec/fume/nav/helper_ext_spec.rb