Sha256: 666174d20aeae1de5fccf1b4e746e09e8da807acebfbef761b6e02ec6810b85f

Contents?: true

Size: 1.45 KB

Versions: 9

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe 'alchemy/essences/_essence_text_view' do
  let(:essence) { Alchemy::EssenceText.new(body: 'Hello World') }
  let(:content) { Alchemy::Content.new(essence: essence) }

  context 'with blank link value' do
    it "only renders the ingredient" do
      render content, content: content
      expect(rendered).to have_content('Hello World')
      expect(rendered).to_not have_selector('a')
    end
  end

  context 'with a link set' do
    let(:essence) { Alchemy::EssenceText.new(body: 'Hello World', link: 'http://google.com', link_title: 'Foo', link_target: 'blank') }

    it "renders the linked ingredient" do
      render content, content: content
      expect(rendered).to have_content('Hello World')
      expect(rendered).to have_selector('a[title="Foo"][target="_blank"][data-link-target="blank"][href="http://google.com"]')
    end

    context 'with html_options given' do
      it "renders the linked with these options" do
        render content, content: content, html_options: {title: 'Bar', class: 'blue'}
        expect(rendered).to have_selector('a.blue[title="Bar"][target="_blank"][data-link-target="blank"]')
      end
    end

    context 'but with options disable_link set to true' do
      it "only renders the ingredient" do
        render content, content: content, options: {disable_link: true}
        expect(rendered).to have_content('Hello World')
        expect(rendered).to_not have_selector('a')
      end
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alchemy_cms-3.0.4 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.3 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.2 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.1 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.0 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.0.rc8 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.0.rc7 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.0.rc6 spec/views/essences/essence_text_view_spec.rb
alchemy_cms-3.0.0.rc5 spec/views/essences/essence_text_view_spec.rb