refactor: namespace for the concern

This commit is contained in:
Shivam Mishra
2025-07-16 09:52:37 +05:30
parent b1d26887f0
commit 9db096f046
5 changed files with 7 additions and 8 deletions
-1
View File
@@ -43,7 +43,6 @@ module Chatwoot
config.eager_load_paths << Rails.root.join('enterprise/listeners')
# rubocop:disable Rails/FilePath
config.eager_load_paths += Dir["#{Rails.root}/enterprise/app/**"]
config.eager_load_paths << Rails.root.join('enterprise/app/models/concerns')
# rubocop:enable Rails/FilePath
# Add enterprise views to the view paths
config.paths['app/views'].unshift('enterprise/app/views')
+1 -1
View File
@@ -18,7 +18,7 @@
#
class Captain::Assistant < ApplicationRecord
include Avatarable
include CaptainToolsHelpers
include Concerns::CaptainToolsHelpers
self.table_name = 'captain_assistants'
+1 -1
View File
@@ -21,7 +21,7 @@
# index_captain_scenarios_on_enabled (enabled)
#
class Captain::Scenario < ApplicationRecord
include CaptainToolsHelpers
include Concerns::CaptainToolsHelpers
self.table_name = 'captain_scenarios'
@@ -1,6 +1,6 @@
# Provides helper methods for working with Captain agent tools including
# tool resolution, text parsing, and metadata retrieval.
module CaptainToolsHelpers
module Concerns::CaptainToolsHelpers
extend ActiveSupport::Concern
# Regular expression pattern for matching tool references in text.
@@ -1,10 +1,10 @@
require 'rails_helper'
RSpec.describe CaptainToolsHelpers, type: :concern do
RSpec.describe Concerns::CaptainToolsHelpers, type: :concern do
# Create a test class that includes the concern
let(:test_class) do
Class.new do
include CaptainToolsHelpers
include Concerns::CaptainToolsHelpers
def self.name
'TestClass'
@@ -17,7 +17,7 @@ RSpec.describe CaptainToolsHelpers, type: :concern do
describe 'TOOL_REFERENCE_REGEX' do
it 'matches tool references in text' do
text = 'Use (tool://add_contact_note) and (tool://update_priority)'
matches = text.scan(CaptainToolsHelpers::TOOL_REFERENCE_REGEX)
matches = text.scan(Concerns::CaptainToolsHelpers::TOOL_REFERENCE_REGEX)
expect(matches.flatten).to eq(%w[add_contact_note update_priority])
end
@@ -32,7 +32,7 @@ RSpec.describe CaptainToolsHelpers, type: :concern do
]
invalid_formats.each do |format|
matches = format.scan(CaptainToolsHelpers::TOOL_REFERENCE_REGEX)
matches = format.scan(Concerns::CaptainToolsHelpers::TOOL_REFERENCE_REGEX)
expect(matches).to be_empty, "Should not match: #{format}"
end
end