Sha256: 84935a73898af9f23693d0037a90e7caef772cbdcbd2b4424f30ad825cc354d2

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Liquid custom tags", type: :feature do
  describe "for `gist` tag" do
    let(:gist_id) { "0d6f8a168a225fda62e8d2ddfe173271" }
    let(:gist_id_js) { "https://gist.github.com/#{gist_id}.js" }
    let(:gist_path) { "dfreerksen/#{gist_id}" }
    let(:gist_path_js) { "https://gist.github.com/#{gist_path}.js" }
    let(:gist_file) { "hello.rb" }

    it "returns the gist with id" do
      create(:page, slug: "amazing", content: "{% gist '#{gist_id}' %}")

      visit "/amazing"

      expected = "script[src='#{gist_id_js}']"

      expect(page).to have_css(expected, visible: false)
    end

    it "returns the gist file with id" do
      content = "{% gist '#{gist_id}' file: '#{gist_file}' %}"

      create(:page, slug: "amazing", content: content)

      visit "/amazing"

      expected = "script[src='#{gist_id_js}?file=#{gist_file}']"

      expect(page).to have_css(expected, visible: false)
    end

    it "returns the gist with path" do
      create(:page, slug: "amazing", content: "{% gist '#{gist_path}' %}")

      visit "/amazing"

      expected = "script[src='#{gist_path_js}']"

      expect(page).to have_css(expected, visible: false)
    end

    it "returns the gist file with path" do
      content = "{% gist '#{gist_path}' file: '#{gist_file}' %}"

      create(:page, slug: "amazing", content: content)

      visit "/amazing"

      expected = "script[src='#{gist_path_js}?file=#{gist_file}']"

      expect(page).to have_css(expected, visible: false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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