Skip to content

Commit a74befe

Browse files
committed
refactor: Simplify Rails component loading and remove ActiveRecord configurations
Updated config/application.rb to load Rails components directly instead of using an array, enhancing clarity. Removed ActiveRecord-related configurations from spec/rails_helper.rb, as the application uses Couchbase instead of ActiveRecord, streamlining the test setup. This change improves maintainability and aligns with the application's architecture.
1 parent 7cb75c9 commit a74befe

File tree

2 files changed

+10
-30
lines changed

2 files changed

+10
-30
lines changed

config/application.rb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@
22

33
# Load Rails components individually (excluding activerecord since we use Couchbase via couchbase-orm)
44
require 'rails'
5-
%w(
6-
action_controller
7-
action_view
8-
action_mailer
9-
active_job
10-
).each do |framework|
11-
begin
12-
require "#{framework}/railtie"
13-
rescue LoadError
14-
end
15-
end
5+
require 'action_controller/railtie'
6+
require 'action_view/railtie'
7+
require 'action_mailer/railtie'
8+
require 'active_job/railtie'
169

1710
# Excluded components (using Couchbase instead of ActiveRecord):
1811
# - active_record/railtie - Using Couchbase via couchbase-orm

spec/rails_helper.rb

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,13 @@
2222
#
2323
# Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f }
2424

25-
# Checks for pending migrations and applies them before tests are run.
26-
# If you are not using ActiveRecord, you can remove these lines.
27-
# NOTE: Commented out - this application uses Couchbase, not ActiveRecord with SQL database
28-
# begin
29-
# ActiveRecord::Migration.maintain_test_schema!
30-
# rescue ActiveRecord::PendingMigrationError => e
31-
# abort e.to_s.strip
32-
# end
33-
RSpec.configure do |config|
34-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
35-
# NOTE: Commented out - this application uses Couchbase, not ActiveRecord
36-
# config.fixture_paths = [
37-
# Rails.root.join('spec/fixtures')
38-
# ]
25+
# NOTE: ActiveRecord is not used in this application - it uses Couchbase via couchbase-orm
26+
# The following ActiveRecord-specific configurations have been removed:
27+
# - ActiveRecord::Migration.maintain_test_schema!
28+
# - config.fixture_paths
29+
# - config.use_transactional_fixtures
3930

40-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
41-
# examples within a transaction, remove the following line or assign false
42-
# instead of true.
43-
# NOTE: Commented out - this application uses Couchbase, not ActiveRecord
44-
# config.use_transactional_fixtures = true
31+
RSpec.configure do |config|
4532

4633
# You can uncomment this line to turn off ActiveRecord support entirely.
4734
config.use_active_record = false

0 commit comments

Comments
 (0)