diff --git a/db/schema.rb b/db/schema.rb index c6a5828..adaf680 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_01_14_030718) do +ActiveRecord::Schema.define(version: 20_200_114_030_718) do create_table "bookmarks", force: :cascade do |t| t.integer "user_id", null: false diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 70ba8db..5572dcd 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # This file is copied to spec/ when you run 'rails generate rspec:install' require 'simplecov' @@ -20,7 +21,7 @@ ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'spec_helper' @@ -47,7 +48,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } +Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } # Checks for pending migration and applies them before tests are run. # If you are not using ActiveRecord, you can remove this line. @@ -67,9 +68,9 @@ Capybara.register_driver :selenium_chrome_headless_sandboxless do |app| driver = Capybara::Selenium::Driver.new(app, - browser: :remote, - capabilities: capabilities, - url: ENV['HUB_URL']) + browser: :remote, + capabilities: capabilities, + url: ENV['HUB_URL']) # Fix for capybara vs remote files. Selenium handles this for us driver.browser.file_detector = lambda do |argss| @@ -87,7 +88,6 @@ Capybara.app_host = "http://#{ip}:#{Capybara.server_port}" else - # Adding chromedriver for js testing. Capybara.register_driver :selenium_chrome_headless_sandboxless do |app| browser_options = ::Selenium::WebDriver::Chrome::Options.new @@ -161,10 +161,6 @@ DatabaseCleaner.clean end - config.after(:suite) do - stop_ldap - end - config.include FactoryBot::Syntax::Methods config.include Devise::Test::IntegrationHelpers, type: :system @@ -180,19 +176,4 @@ config.after(:each) do ActiveFedora::Cleaner.clean! end - -end - -# Deletes everything in Fedora. -def clean_fedora - ActiveFedora::Cleaner.clean! -end - -## -# Deletes everything in Solr. -def clean_solr - solr = ActiveFedora::SolrService.instance.conn - solr.delete_by_query("*:*", params: { commit: true }) -end - - +end \ No newline at end of file diff --git a/spec/support/download_helpers.rb b/spec/support/download_helpers.rb index 96c7598..ee555c6 100644 --- a/spec/support/download_helpers.rb +++ b/spec/support/download_helpers.rb @@ -1,36 +1,37 @@ # frozen_string_literal: true + module DownloadHelpers - TIMEOUT = 20 - PATH = Rails.root.join('tmp', 'downloads') + TIMEOUT = 20 + PATH = Rails.root.join('tmp', 'downloads') - def downloads - Dir[PATH.join('*')] - end + def downloads + Dir[PATH.join('*')] + end - def download - downloads.first - end + def download + downloads.first + end - def download_content - wait_for_download - File.read(download) - end + def download_content + wait_for_download + File.read(download) + end - def wait_for_download - Timeout.timeout(TIMEOUT) do - sleep 0.1 until downloaded? - end + def wait_for_download + Timeout.timeout(TIMEOUT) do + sleep 0.1 until downloaded? end + end - def downloaded? - !downloading? && downloads.any? - end + def downloaded? + !downloading? && downloads.any? + end - def downloading? - downloads.grep(/\.crdownload$/).any? - end + def downloading? + downloads.grep(/\.crdownload$/).any? + end - def clear_downloads - FileUtils.rm_f(downloads) - end + def clear_downloads + FileUtils.rm_f(downloads) end +end