Sha256: bfa889e5236ad0537cf3b85f5d245b9e3b8886427d7e49b7df506ccac99c69d8

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require 'spec_helper'

describe 'documents', :type => :request, :js => true do

  let(:user) { User.create }
  before(:each) do
    Document.destroy_all
    visit edit_user_path(user)
  end

  it 'should be auto associated' do
    within '.simple_attachments_multiple_div' do
      attach_sample :pdf
      user.documents.count.should == 1
    end
  end

  it 'should not show field with invalid file' do
    within '.simple_attachments_multiple_div' do
      attach_sample :jpg
      page.should_not have_selector('.simple_attachments_field_div')
    end
  end

  it 'should allow asynchronous upload and destroy' do
    within '.simple_attachments_multiple_div' do
      5.times { attach_sample :pdf, 0 }
      attach_sample :pdf
      3.times { find('.simple_attachments_destroy_link').click }
      attach_sample :pdf, 0
      attach_sample :pdf
      user.documents.count.should == 5
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_attachments-0.1.1 test/spec/multiple_spec.rb