Sha256: 38fa02a0969ba045351a6ee12836367a4431b6bf69329b8854309e40a443ce22

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  RSpec.describe TemplateRenderService, type: :service do
    context "#new" do
      it "builds the liquid content" do
        template = create(:template)
        content = "<p>This is the content of the page</p>"

        rendered = described_class.new(template,
                                       content_for_layout: content).call

        expect(rendered).to include("<p>This is the content of the page</p>")
      end
    end

    context ".call" do
      it "builds the liquid content" do
        template = create(:template)
        content = "<p>This is the content of the page</p>"

        rendered = described_class.call(template,
                                        content_for_layout: content)

        expect(rendered).to include("<p>This is the content of the page</p>")
      end

      it "builds the liquid content even without `{{ content_for_layout }}`" do
        template = create(:template, content: "FULL TEMPLATE")
        content = "<p>Content of the page is still rendered</p>"

        rendered = described_class.call(template,
                                        content_for_layout: content)

        expect(rendered)
          .to include("<p>Content of the page is still rendered</p>")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
archangel-0.3.0 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.8 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.7 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.6 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.5 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.4 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.3 spec/services/archangel/template_render_service_spec.rb
archangel-0.0.2 spec/services/archangel/template_render_service_spec.rb