Sha256: 54c37a6cec503b802130d461d21edadef226004d6a0368e4e872ff770a8a3b63

Contents?: true

Size: 976 Bytes

Versions: 24

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

feature "Attachments" do
  background do
    sign_in
  end

  scenario "show message if item is not saved" do
    click_link "Blogs"
    click_link "Create new blog"
    page.should have_content "First save to enable uploads"
  end

  scenario "show upload form" do
    create(:blog)
    click_link "Blogs"
    click_link "Edit"
    page.should have_selector "#attachments"
  end

  context "with image" do
    background do
      blog = create(:blog)
      @attachment = blog.attachments.create!(:asset => Rails.root.join("public/rails.png").open)
      click_link "Blogs"
      click_link "Edit"
    end

    scenario "shows images" do
      page.should have_selector "[data-attachment-id=\"#{@attachment.id}\"]"
    end

    scenario "delete image" do
      within "[data-attachment-id=\"#{@attachment.id}\"]" do
        click_link "Delete"
      end
      page.should_not have_selector "[data-attachment-id=\"#{@attachment.id}\"]"
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
brightcontent-attachments-2.1.3 spec/features/attachments_spec.rb
brightcontent-attachments-2.1.2 spec/features/attachments_spec.rb
brightcontent-attachments-2.1.1 spec/features/attachments_spec.rb
brightcontent-attachments-2.1.0 spec/features/attachments_spec.rb