Sha256: e72b18c725e1a88f09bf1ffe943fa2e90fc144a38a2683f4cd7be3972d706b20

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

RSpec.describe Blacklight::Icon do
  subject { described_class.new(:search, classes: 'awesome') }
  describe '#svg' do
    it 'returns a string' do
      expect(subject.svg).to be_an String
    end
    it 'returns raw svg' do
      expect(Capybara.string(subject.svg))
        .to have_css 'svg title', text: 'Search'
    end
  end
  describe '#options' do
    it 'applies options classes and default class' do
      expect(subject.options[:class]).to eq 'blacklight-icons awesome'
    end
  end
  describe '#path' do
    it 'prepends blacklight and sufixes .svg' do
      expect(subject.path).to eq 'blacklight/search.svg'
    end
  end
  describe 'file_source' do
    context 'file is not available' do
      subject { described_class.new(:yolo) }
      it { expect { subject.file_source }
        .to raise_error(Blacklight::Exceptions::IconNotFound) }
    end
    context 'file is available' do
      it 'returns the filesource' do
        expect(subject.file_source).to include '<svg'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-7.0.0.rc1 spec/models/blacklight/icon_spec.rb