Sha256: d587aba98d4a990fb6e6aa735f583135b0da2372790fc5ff94c9405e9c1a534c
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require "rails_helper" module Archangel module Liquid module Tags RSpec.describe GistTag, type: :liquid_tag do let(:site) { create(:site) } let(:context) do ::Liquid::Context.new({ "site" => site }, {}, view: view) end it "raises error with invalid syntax" do content = "{% gist %}" expect { ::Liquid::Template.parse(content).render(context) }.to( raise_error(::Liquid::SyntaxError) ) end it "returns gist" do gist = "9bbaf7332bff1042c2d83fc88683b9df" result = ::Liquid::Template.parse("{% gist '#{gist}' %}") .render(context) expect(result).to include("https://gist.github.com/#{gist}.js") end it "returns gist with file" do gist = "9bbaf7332bff1042c2d83fc88683b9df" file = "hello.rb" content = "{% gist '#{gist}' file: '#{file}' %}" result = ::Liquid::Template.parse(content).render(context) expect(result) .to include("https://gist.github.com/#{gist}.js?file=#{file}") end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems