Sha256: 6e317c42186bfcef595d50d3de95b1b3977abe01fcfc26e297f45243a3c973af

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Calagator
  describe TagsHelper, type: :helper do
    describe '#tag_links_for' do
      it 'renders tag links for the supplied model' do
        event = FactoryBot.create(:event, tag_list: %w[b a])
        expect(tag_links_for(event)).to match_dom_of \
          %(<a href="/events/tag/a" class="p-category">a</a>, ) +
          %(<a href="/events/tag/b" class="p-category">b</a>)
      end
    end

    describe '#display_tag_icons' do
      before do
        @event = FactoryBot.create(:event, tag_list: %w[ruby pizza])
        @event2 = FactoryBot.create(:event, tag_list: %w[no_image also_no_image])
        @untagged_event = Event.new
      end

      it 'should render nothing if no image tags' do
        expect(helper.display_tag_icons(@event2)).to eq ' '
      end

      it 'should render nothing if event has no tags' do
        expect(helper.display_tag_icons(@untagged_event)).to eq ''
      end

      it 'should render an image if the event tag has one associated' do
        expect(helper.display_tag_icons(@event)).to include 'img'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calagator-1.1.0 spec/helpers/calagator/tags_helper_spec.rb