Sha256: af950610773f0efb36caab412acf0c2f064093294d6f31a2316fabb00e442bce

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  module Liquid
    module Tags
      RSpec.describe VimeoTag, type: :liquid_tag do
        let(:context) { ::Liquid::Context.new({}, {}, view: view) }

        it "raises error with invalid syntax" do
          content = "{% vimeo %}"

          expect { ::Liquid::Template.parse(content).render(context) }.to(
            raise_error(::Liquid::SyntaxError)
          )
        end

        it "returns default Vimeo embed" do
          result = ::Liquid::Template.parse("{% vimeo '183344978' %}")
                                     .render(context)

          expect(result).to include("https://player.vimeo.com/video/183344978")
          expect(result).to include("width=\"640\"")
          expect(result).to include("height=\"360\"")
        end

        it "returns Vimeo embed with options" do
          template = "{% vimeo '183344978' width:800 height:600 %}"
          result = ::Liquid::Template.parse(template).render(context)

          expect(result).to include("https://player.vimeo.com/video/183344978")
          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

Version Path
archangel-0.3.0 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.8 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.7 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.6 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.5 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.4 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.3 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb
archangel-0.0.2 spec/lib/archangel/liquid/tags/vimeo_tag_spec.rb