Sha256: 2e6fea815cb4efb8feaa9e51a99678a5dd88fa87c10f4f36b5f66c68e17eb719
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' describe "Create and use single-use links", :type => :feature do include Warden::Test::Helpers Warden.test_mode! include Sufia::Engine.routes.url_helpers let(:user) { FactoryGirl.find_or_create(:jill) } let(:file) do GenericFile.new.tap do |f| f.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png') f.apply_depositor_metadata(user) f.save end end before do login_as user end it "generates 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 describe "download link" do before do @old_driver = Capybara.current_driver Capybara.current_driver = :rack_test end after do Capybara.current_driver = @old_driver end it "downloads 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.id).content.content expect(page.source).to eq expected_content end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sufia-6.0.0.rc2 | spec/features/single_use_links_spec.rb |
sufia-6.0.0.rc1 | spec/features/single_use_links_spec.rb |
sufia-6.0.0.beta1 | spec/features/single_use_links_spec.rb |