Sha256: 8e3b32e44974bfe2c09bd6a2af5aeac1254039249d57d8e77b9b39ddf613c206

Contents?: true

Size: 990 Bytes

Versions: 9

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

describe 'Editing attached files' do
  let(:user) { create(:user) }
  let!(:parent) { create(:work_with_one_file, user: user) }
  let!(:file_set) { parent.file_sets.first }

  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 Generic File 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

9 entries across 9 versions & 1 rubygems

Version Path
curation_concerns-0.10.0 spec/features/update_file_spec.rb
curation_concerns-0.9.0 spec/features/update_file_spec.rb
curation_concerns-0.8.0 spec/features/update_file_spec.rb
curation_concerns-0.7.0 spec/features/update_file_spec.rb
curation_concerns-0.6.0 spec/features/update_file_spec.rb
curation_concerns-0.5.0 spec/features/update_file_spec.rb
curation_concerns-0.4.0 spec/features/update_file_spec.rb
curation_concerns-0.3.0 spec/features/update_file_spec.rb
curation_concerns-0.2.0 spec/features/update_file_spec.rb