Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure test base created in hyrax 4 docker #1013

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ gem 'terser', '~> 1.1'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', '~> 11.1.3', platform: :mri
gem 'database_cleaner'
gem 'fcrepo_wrapper', '~> 0.9.0'
gem 'rspec-rails', '~> 5.1.2'
# Rubocop for style and error checking (linter)
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.3)
declarative (0.0.20)
deprecation (1.1.0)
Expand Down Expand Up @@ -1071,6 +1077,7 @@ DEPENDENCIES
capybara (~> 3.36)
clamav-client
coffee-rails (~> 5.0.0)
database_cleaner
devise (~> 4.8.0)
devise-guests (~> 0.8.1)
edtf-humanize (= 2.0.1)
Expand Down
18 changes: 18 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,27 @@

# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.

ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
DatabaseCleaner.url_allowlist = [ENV['DATABASE_URL']]

config.before(:suite) do
DatabaseCleaner.clean_with :truncation
DatabaseCleaner.strategy = :transaction
end

config.before do
DatabaseCleaner.start
end

config.after do
DatabaseCleaner.clean
rescue
puts 'database clean failed'
end

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

Expand Down