Sha256: f7f235346fc98225f381cce62b5bfcebcc49cb20c25fa13d6dbf93d9975ac181

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Breadcrumby::Viewer, '.link_tag_name' do
  subject { described_class.new object, options }

  let!(:action)  { :edit }
  let!(:object)  { build :school }
  let!(:options) { {} }

  context 'when action is not given' do
    before do
      allow(subject).to receive(:i18n_name).with(object) { :i18n_name }
    end

    it 'build a ta name with object properties' do
      expect(subject.link_tag_name(object, nil)).to have_tag(:span, with: { itemprop: 'name' }) do
        with_text 'i18n_name'
      end
    end
  end

  context 'when action is given' do
    before do
      allow(subject).to receive(:i18n_action_name).with(object, action) { :i18n_action_name }
    end

    it 'build a ta name with object and action properties' do
      expect(subject.link_tag_name(object, action)).to have_tag(:span, with: { itemprop: 'name' }) do
        with_text 'i18n_action_name'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
breadcrumby-0.1.0 spec/lib/breadcrumby/models/viewer/link_tag_name_spec.rb