Sha256: a0a59a67f84e01b204564698ff7689cc733639fff9280e8184b81d3216d6f763

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  RSpec.describe RenderService, type: :service do
    let(:render_content) do
      %(
        {% assign foo="bar" %}
        ~{{ foo }}~
        *{{ bat }}*
      )
    end

    context "with #new" do
      it "return liquid content with value for `foo`" do
        rendered = described_class.new(render_content).call

        expect(rendered).to include("~bar~")
      end

      it "return custom liquid content with value for `bat`" do
        rendered = described_class.new(render_content, bat: "baz").call

        expect(rendered).to include("*baz*")
      end
    end

    context "with .call" do
      it "return liquid content with value for `foo`" do
        rendered = described_class.call(render_content)

        expect(rendered).to include("~bar~")
      end

      it "return custom liquid content with value for `bat`" do
        rendered = described_class.call(render_content, bat: "baz")

        expect(rendered).to include("*baz*")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/unit/services/archangel/render_service_spec.rb