Sha256: e710b1b5cf21ed8697a9e1997c21b2b234c9e5994cb03f82e7e9541a9eb8534d

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Liquid custom tags", type: :feature do
  describe "for `vimeo` tag" do
    let(:vimeo_id) { "1234567890" }

    it "returns video with valid video" do
      create(:page, slug: "amazing", content: "{% vimeo '#{vimeo_id}' %}")

      visit "/amazing"

      expect(page).to(
        have_css("iframe[src^='https://player.vimeo.com/video/#{vimeo_id}']")
      )
    end

    it "returns video with `class` attribute set" do
      content = "{% vimeo '#{vimeo_id}' class:'amazing-video' %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[class='amazing-video']")
    end

    it "returns video with `width` attribute set" do
      content = "{% vimeo '#{vimeo_id}' width:400 %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[width='400']")
    end

    it "returns video with `width` attribute as percent" do
      content = "{% vimeo '#{vimeo_id}' width:'100%' %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[width='100%']")
    end

    it "returns video with `autoplay` param on" do
      content = "{% vimeo '#{vimeo_id}' autoplay:1 %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[src*='autoplay=1']")
    end

    it "returns video with `width` param" do
      content = "{% vimeo '#{vimeo_id}' width:400 %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[src*='width=400']")
    end

    it "returns video with `width` param as percent" do
      content = "{% vimeo '#{vimeo_id}' width:'100%' %}"

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

      visit "/amazing"

      expect(page).to have_css("iframe[src*='width=100%']")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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