Sha256: bc040a5b13f61e65768504dbf1b0eca782a383dd46e0cf90d5ed7694eb71bf83

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe "In the dashboard, Media", type: :feature do
  include Storytime::Dashboard::MediaHelper

  before{ login_admin }

  it "creates media", js: true do
    visit dashboard_media_index_path

    attach_file('media_file', "./spec/support/images/success-kid.jpg")

    expect(find("#media_gallery").find("img")['src']).to have_content('success-kid.jpg')
  end

  it "shows a gallery of the user's images" do
    m1 = FactoryGirl.create(:media, site: @current_site)
    m2 = FactoryGirl.create(:media, site: @current_site)

    visit dashboard_media_index_path

    page.should have_image(m1.file_url(:thumb))
    page.should have_image(m2.file_url(:thumb))
  end

  it "deletes an image", js: true do
    image = FactoryGirl.create(:media, site: @current_site)

    visit dashboard_media_index_path
    page.should have_image(image.file_url(:thumb))

    click_link "delete_media_#{image.id}"

    page.should_not have_image(image)
  end

  it "inserts media into post", js: true do
    media = FactoryGirl.create(:media, site: @current_site)

    visit url_for([:new, :dashboard, @current_site.blogs.first, :blog_post, only_path: true])

    find(".insert-media-button").click

    within "#media_#{media.id}" do
      find(".insert-image-button").click
    end

    expect(page).to have_image(media.file_url)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
storytime-2.1.6 spec/features/dashboard/media_spec.rb
storytime-2.1.5 spec/features/dashboard/media_spec.rb
storytime-2.1.4 spec/features/dashboard/media_spec.rb
storytime-2.1.3 spec/features/dashboard/media_spec.rb
storytime-2.1.2 spec/features/dashboard/media_spec.rb
storytime-2.1.1 spec/features/dashboard/media_spec.rb
storytime-2.1.0 spec/features/dashboard/media_spec.rb