Sha256: 03e72073032a2f3a4249023a107cb8abbc44a56c0c5140844ba3d168884b8b8e

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

feature 'Editing attached files' do
  let(:user) { create(:user) }
  let!(:parent) { create(:work_with_one_file, user: user) }
  let!(:file_set) { parent.file_sets.first }
  let!(:sipity_entity) do
    create(:sipity_entity, proxy_for_global_id: parent.to_global_id.to_s)
  end
  around do |example|
    original_adapter = ActiveJob::Base.queue_adapter
    ActiveJob::Base.queue_adapter = :inline
    example.run
    ActiveJob::Base.queue_adapter = original_adapter
  end

  before do
    sign_in user
    # stub out characterization. Travis doesn't have fits installed, and it's not relevant to the test.
    expect(CharacterizeJob).to receive(:perform_later)
  end

  it 'updates the file' do
    visit "/concern/generic_works/#{parent.id}"
    click_link 'Edit'
    expect(page).to have_content "Updating Attached File to \"Test title\""

    attach_file('Upload a file', fixture_file_path('files/image.png'))
    click_button 'Update Attached File'

    expect(page).to have_content 'The file A Contained FileSet has been updated.'

    # TODO: this stuff belongs in an Actor or Controller test:
    file_set.reload
    expect(file_set.original_file.original_name).to eq 'image.png'
    expect(file_set.original_file.mime_type).to eq 'image/png'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/features/update_file_spec.rb
curation_concerns-1.7.7 spec/features/update_file_spec.rb
curation_concerns-2.0.0 spec/features/update_file_spec.rb
curation_concerns-2.0.0.rc2 spec/features/update_file_spec.rb
curation_concerns-1.7.6 spec/features/update_file_spec.rb
curation_concerns-1.7.5 spec/features/update_file_spec.rb
curation_concerns-1.7.4 spec/features/update_file_spec.rb
curation_concerns-1.7.3 spec/features/update_file_spec.rb
curation_concerns-1.7.2 spec/features/update_file_spec.rb
curation_concerns-2.0.0.rc1 spec/features/update_file_spec.rb
curation_concerns-1.7.1 spec/features/update_file_spec.rb
curation_concerns-1.7.0 spec/features/update_file_spec.rb