Sha256: 61d7ca1d6a9eb86c4ef36f7436d39b397d5d99abf89575c5928467ed427bdbaa

Contents?: true

Size: 1.23 KB

Versions: 18

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe 'alchemy/essences/_essence_link_view' do
  let(:essence) { Alchemy::EssenceLink.new(link: 'http://google.com') }
  let(:content) { Alchemy::Content.new(essence: essence) }
  let(:options) { {} }

  context 'without value' do
    let(:essence) { Alchemy::EssenceLink.new(link: nil) }

    it "renders nothing" do
      render content, content: content, options: options, html_options: {}
      expect(rendered).to eq('')
    end
  end

  it "renders a link" do
    render content, content: content, options: options, html_options: {}
    expect(rendered).to eq('<a href="http://google.com">http://google.com</a>')
  end

  context 'with text option' do
    let(:options) { {text: 'Google'} }

    it "renders a link" do
      render content, content: content, options: options, html_options: {}
      expect(rendered).to eq('<a href="http://google.com">Google</a>')
    end
  end

  context 'with text setting on content description' do
    before do
      allow(content).to receive(:settings).and_return({text: 'Yahoo'})
    end

    it "renders a link" do
      render content.essence, content: content, options: options, html_options: {}
      expect(rendered).to eq('<a href="http://google.com">Yahoo</a>')
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.3 spec/views/essences/essence_link_view_spec.rb
lc_alchemy_cms-3.2.1 spec/views/essences/essence_link_view_spec.rb
lc_alchemy_cms-3.2.0 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.2.0 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.2.0.rc1 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.2.0.beta spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.1 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.rc3 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.rc2 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.rc1 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta6 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta5 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta4 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta3 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta2 spec/views/essences/essence_link_view_spec.rb
alchemy_cms-3.1.0.beta1 spec/views/essences/essence_link_view_spec.rb