Sha256: 6c95068903ad64355a52b23d26f12b8c9452ecead33ec58e6675fff75c2de8f7
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
require 'spec_helper' describe "Create and use single-use links" do include Warden::Test::Helpers Warden.test_mode! include Sufia::Engine.routes.url_helpers before do user = FactoryGirl.find_or_create(:jill) login_as(user) @file = GenericFile.new @file.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png') @file.apply_depositor_metadata(user) @file.save end it "should generate a single-use link to show the record" do visit generate_show_single_use_link_path(id: @file) expect(page).to have_css '.single-use-link a' find('.single-use-link a').click expect(page).to have_content 'world.png' expect(page).to have_content "Download (can only be used once)" end it "should download the file contents" do visit generate_download_single_use_link_path(id: @file) expect(page).to have_css '.download-link' find('.download-link').click expected_content = ActiveFedora::Base.find(@file.pid, cast: true).content.content expect(page.body).to eq expected_content end end
Version data entries
6 entries across 6 versions & 1 rubygems