Sha256: e5721d54c3f836636c8d99d2880ad68f74bbca3137608d613c27a6bb7cf77b04

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

# coding: utf-8

require 'spec_helper'

describe "Video block" do
  let(:article) { create(:article) }

  before(:each) do
    clean_database
    visit_article
  end

  def visit_article() visit "/admin/articles/#{article.id}/edit"; end
  def add_block() find_link(I18n.t("redditor.add.video_block")).click; end
  def submit() find_button("Submit").click; end
  def save_block() find("a.redditor__update").click; end
  def delete_block() find("a.redditor__delete").click; end

  it "Saves video block to article", type: :feature, js: true do
    add_block
    page.find(".video-block-input").set("1"*11)
    submit
    expect(page.find("iframe").nil?).to eq false
  end

  it "Shows validation error if youtube block url is empty or invalid", type: :feature, js: true do
    add_block
    submit
    expect(page.find(".errors")).to have_content "is the wrong length"
  end

  it "Deletes video block", type: :feature, js: true do
    article.page.video_blocks.build(youtube: "1"*11, position: 1).save
    visit_article
    delete_block
    visit_article
    video_frame = begin
      page.find("iframe")
    rescue
      nil
    end
    expect(video_frame).to eq nil
  end

  it "Saves video block to article on save button", type: :feature, js: true do
    add_block
    page.find(".video-block-input").set("1"*11)
    save_block
    visit_article
    expect(page.find("iframe").nil?).to eq false
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redditor-0.1.12 spec/features/video_spec.rb
redditor-0.1.11 spec/features/video_spec.rb
redditor-0.1.10 spec/features/video_spec.rb
redditor-0.1.9 spec/features/video_spec.rb
redditor-0.1.8 spec/features/video_spec.rb
redditor-0.1.7 spec/features/video_spec.rb
redditor-0.1.6 spec/features/video_spec.rb