Sha256: d11d16644751eee7de21ba643a1109cf691d5b2b93559b283deb7c765f121073

Contents?: true

Size: 1.24 KB

Versions: 19

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe 'alchemy/essences/_essence_richtext_view' do
  let(:essence) { Alchemy::EssenceRichtext.new(body: '<h1>Lorem ipsum dolor sit amet</h1> <p>consectetur adipiscing elit.</p>', stripped_body: 'Lorem ipsum dolor sit amet consectetur adipiscing elit.') }
  let(:content) { Alchemy::Content.new(essence: essence) }

  it "renders the html body" do
    render content, content: content
    expect(rendered).to have_content('Lorem ipsum dolor sit amet consectetur adipiscing elit.')
    expect(rendered).to have_selector('h1')
  end

  context 'with options[:plain_text] true' do
    it "renders the text body" do
      render content, content: content, options: {plain_text: true}
      expect(rendered).to have_content('Lorem ipsum dolor sit amet consectetur adipiscing elit.')
      expect(rendered).to_not have_selector('h1')
    end
  end

  context 'with content.settings[:plain_text] true' do
    before do
      allow(content).to receive(:settings).and_return({plain_text: true})
    end

    it "renders the text body" do
      render content.essence, content: content
      expect(rendered).to have_content('Lorem ipsum dolor sit amet consectetur adipiscing elit.')
      expect(rendered).to_not have_selector('h1')
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

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