Sha256: 89ba4e2d4967cf4d517ac3c56b2f6ad471f56c4547d427fdfbb420c2ca1b9a9e
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe Breadcrumby::Viewer, '.link' 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 } allow(subject).to receive(:link_options).with(object, nil) { { class: :custom } } end it 'build a link with object properties' do expect(subject.link(object)).to have_tag(:a, with: { href: 'school.show.path' }) do with_tag(:span, with: { itemprop: 'name' }) do with_text 'i18n_name' end 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 link with object and action properties' do expect(subject.link(object, action: action)).to have_tag(:a, with: { itemprop: 'item', itemscope: 'itemscope', itemtype: 'http://schema.org/Thing', title: 'translation missing: en.breadcrumby.actions.edit.title', href: 'javascript:void(0);' }) do with_tag(:span, with: { itemprop: 'name' }) do with_text 'i18n_action_name' end 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_spec.rb |