Sha256: 4a3c6f1d3143b393c94e3c1d8215a11150ab91e0441dacaabae00aef30e21c2f
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true require "rails_helper" module Archangel module Liquid module Tags RSpec.describe YoutubeTag, type: :liquid_tag do let(:context) { ::Liquid::Context.new({}, {}, view: view) } it "raises error with invalid syntax" do content = "{% youtube %}" expect { ::Liquid::Template.parse(content).render(context) }.to( raise_error(::Liquid::SyntaxError) ) end it "returns default YouTube embed" do result = ::Liquid::Template.parse("{% youtube '-X2atEH7nCg' %}") .render(context) expect(result).to include("https://www.youtube.com/embed/-X2atEH7nCg") expect(result).to include("width=\"640\"") expect(result).to include("height=\"360\"") end it "returns YouTube embed with options" do template = "{% youtube '-X2atEH7nCg' width:800 height:600 %}" result = ::Liquid::Template.parse(template).render(context) expect(result).to include("https://www.youtube.com/embed/-X2atEH7nCg") expect(result).to include("width=\"800\"") expect(result).to include("height=\"600\"") end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems