Sha256: 5c9b7abc3c592c4f83f91acbc06d5cf752624b97a0e3184acaad34c0b5619908

Contents?: true

Size: 920 Bytes

Versions: 6

Compression:

Stored size: 920 Bytes

Contents

require 'spec_helper'

describe "Editing attached files" do
  let(:user) { FactoryGirl.create(:user) }
  let!(:generic_file) { FactoryGirl.create(:file_with_work, user: user) }

  before do
    sign_in user

    # stub out characterization. Travis doesn't have fits installed, and it's not relevant to the test.
    s2 = double('resque message')
    expect(CharacterizeJob).to receive(:new).and_return(s2)
    expect(Sufia.queue).to receive(:push).with(s2).once
  end

  it "should update the file" do
    visit "/concern/generic_works/#{generic_file.batch.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 image.png has been updated."
    expect(generic_file.reload.content.label).to eq 'image.png'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
worthwhile-0.1.2 spec/features/update_file_spec.rb
worthwhile-0.1.1 spec/features/update_file_spec.rb
worthwhile-0.1.0 spec/features/update_file_spec.rb
worthwhile-0.0.3 spec/features/update_file_spec.rb
worthwhile-0.0.2 spec/features/update_file_spec.rb
worthwhile-0.0.1 spec/features/update_file_spec.rb