Skip to content

Commit

Permalink
Update rails_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkkwang committed Jul 3, 2024
1 parent da485d7 commit f25ff64
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# frozen_string_literal: true

# This file is copied to spec/ when you run 'rails generate rspec:install'
require "spec_helper"
require File.expand_path("hyku_specs/rails_helper.rb", __dir__)

ENV["RAILS_ENV"] ||= "test"
# require File.expand_path('../config/environment', __dir__)
require Rails.root.join("config", "environment")
require File.expand_path("../hyrax-webapp/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 "rspec/rails"
# Add additional requires below this line. Rails is not loaded until this point!
require "factory_bot_rails"
FactoryBot.definition_file_paths = [File.expand_path("spec/factories", HykuKnapsack::Engine.root)]
FactoryBot.find_definitions

if defined?(HykuAddons)
FactoryBot.definition_file_paths = [File.expand_path("spec/factories", HykuAddons::Engine.root)]
FactoryBot.find_definitions
end

require 'capybara/rails'
require 'dry-validation'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
Expand All @@ -31,7 +31,7 @@
# require only the support files necessary.
#
# Require supporting ruby files from spec/support/ and subdirectories. Note: engine, not Rails.root context.
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
Dir[HykuKnapsack::Engine.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
Expand All @@ -41,6 +41,12 @@
# config.include Rails.application.routes.url_helpers
# TODO is this needed?
config.include HykuKnapsack::Engine.routes.url_helpers
config.include Capybara::DSL
config.include Fixtures::FixtureFileUpload

# End override
# To run specs locally without the spec/hyku_specs/ directory do: `bundle exec rspec --tag ~hyku`
config.define_derived_metadata(file_path: %r{spec/hyku_specs/}) do |metadata|
metadata[:hyku] = true
end
## End override
end

0 comments on commit f25ff64

Please sign in to comment.