Sha256: da5e568718ffc494cb3b459b0bac9a1fb9fadbf30f0d046764434544e07b9505

Contents?: true

Size: 990 Bytes

Versions: 2

Compression:

Stored size: 990 Bytes

Contents

require "spec_helper"

RSpec.describe Fume::Nav::NavTag do
  let(:context) { double :context }
  let(:current) { nil }
  let(:attributes) { { helper: context, current: current, active_class: "active", hide_if_empty: true } }
  subject { described_class.new(attributes) }

  describe "#li_tag" do
    let(:current) { :foo }

    context "then match" do
      before { expect(context).to receive(:content_tag).with(:li, hash_including(class: "active")) }
      it { subject.li_tag(:foo) }

      context "value is Regexp" do
        let(:current) { :foo }
        it { subject.li_tag(/^foo/) }
      end
    end

    context "then not match" do
      before { expect(context).to receive(:content_tag).with(:li, hash_excluding(class: "active")) }
      it { subject.li_tag(:not_match) }
    end
  end

  describe "#link_to" do
    before { expect(context).to receive(:link_to).with("TEXT", [:root], hash_excluding(class: "active")) }
    it { subject.link_to :foo, "TEXT", [:root] }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fume-nav-0.1.1 spec/fume/nav/nav_tag_spec.rb
fume-nav-0.1.0 spec/fume/nav/nav_tag_spec.rb