Sha256: 8847dc4b331ab34a6fcfd6525b8d194f2d7828b6f24b35fdc799abf384e9a923

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Liquid custom tags", type: :feature do
  describe "for `widget` tag" do
    let(:design) do
      create(:design, :partial,
             content: "BEFORE {{ content_for_layout }} AFTER")
    end

    before { create(:site) }

    it "returns content with valid Widget slug" do
      create(:widget, slug: "amazing", content: "Good stuff")
      create(:page, slug: "amazing", content: "~{% widget 'amazing' %}~")

      visit "/amazing"

      expect(page.body).to include("~Good stuff~")
    end

    it "returns content with Widget design" do
      create(:widget, design: design, slug: "amazing", content: "Good stuff")
      create(:page, slug: "amazing", content: "~{% widget 'amazing' %}~")

      visit "/amazing"

      expect(page.body).to include("~BEFORE Good stuff AFTER~")
    end

    it "returns nothing for unknown widget" do
      create(:page, slug: "amazing", content: "~{% widget 'unknown' %}~")

      visit "/amazing"

      expect(page.body).to include("~~")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/features/frontend/liquid/tags/widget_spec.rb