chore: Upgrade to Rails 7 (#6719)

fixes: #6736
This commit is contained in:
Sojan Jose
2023-05-06 10:44:52 +05:30
committed by GitHub
parent 59433d9d3c
commit 022383d942
53 changed files with 1696 additions and 682 deletions

View File

@@ -231,8 +231,8 @@ RSpec.describe 'Api::V1::Accounts::Articles', type: :request do
json_response = JSON.parse(response.body)
expect(json_response['payload']['associated_articles'].length).to eq(2)
expect(json_response['payload']['associated_articles'][0]['id']).to eq(child_article_1.id)
expect(json_response['payload']['associated_articles'][1]['id']).to eq(child_article_2.id)
associated_articles_ids = json_response['payload']['associated_articles'].map { |article| article['id'] }
expect(associated_articles_ids).to match_array([child_article_1.id, child_article_2.id])
expect(json_response['payload']['id']).to eq(root_article.id)
end
end

View File

@@ -150,7 +150,7 @@ describe Integrations::Dialogflow::ProcessorService do
end
describe '#get_response' do
let(:google_dialogflow) { Google::Cloud::Dialogflow }
let(:google_dialogflow) { ::Google::Cloud::Dialogflow::V2::Sessions::Client }
let(:session_client) { double }
let(:session) { double }
let(:query_input) { { text: { text: message, language_code: 'en-US' } } }
@@ -158,8 +158,7 @@ describe Integrations::Dialogflow::ProcessorService do
before do
hook.update(settings: { 'project_id' => 'test', 'credentials' => 'creds' })
allow(google_dialogflow).to receive(:sessions).and_return(session_client)
allow(session_client).to receive(:session_path).and_return(session)
allow(google_dialogflow).to receive(:new).and_return(session_client)
allow(session_client).to receive(:detect_intent).and_return({ session: session, query_input: query_input })
end

View File

@@ -8,7 +8,7 @@ describe Integrations::GoogleTranslate::DetectLanguageService do
let(:translate_client) { double }
before do
allow(::Google::Cloud::Translate).to receive(:translation_service).and_return(translate_client)
allow(::Google::Cloud::Translate::V3::TranslationService::Client).to receive(:new).and_return(translate_client)
allow(translate_client).to receive(:detect_language).and_return(::Google::Cloud::Translate::V3::DetectLanguageResponse
.new({ languages: [{ language_code: 'es', confidence: 0.71875 }] }))
end

View File

@@ -14,7 +14,7 @@ describe ::Redis::Config do
it 'checks for app redis config' do
app_config = described_class.app
expect(app_config.keys).to match_array([:url, :password, :network_timeout, :reconnect_attempts, :ssl_params])
expect(app_config.keys).to match_array([:url, :password, :timeout, :reconnect_attempts, :ssl_params])
expect(app_config[:url]).to eq(redis_url)
expect(app_config[:password]).to eq(redis_pasword)
end
@@ -43,7 +43,7 @@ describe ::Redis::Config do
end
it 'checks for app redis config' do
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :network_timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app[:url]).to eq("redis://#{redis_master_name}")
expect(described_class.app[:sentinels]).to match_array(expected_sentinels)
end
@@ -60,7 +60,7 @@ describe ::Redis::Config do
end
it 'checks for app redis config and sentinel passwords will be empty' do
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :network_timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app[:url]).to eq("redis://#{redis_master_name}")
expect(described_class.app[:sentinels]).to match_array(expected_sentinels.map { |s| s.except(:password) })
end
@@ -78,7 +78,7 @@ describe ::Redis::Config do
end
it 'checks for app redis config and redis password is replaced in sentinel config' do
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :network_timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app.keys).to match_array([:url, :password, :sentinels, :timeout, :reconnect_attempts, :ssl_params])
expect(described_class.app[:url]).to eq("redis://#{redis_master_name}")
expect(described_class.app[:sentinels]).to match_array(expected_sentinels.map { |s| s.merge(password: redis_sentinel_password) })
end

View File

@@ -63,10 +63,10 @@ describe ActionCableListener do
a_collection_containing_exactly(
admin.pubsub_token, conversation.contact_inbox.pubsub_token
),
'conversation.typing_on', conversation: conversation.push_event_data,
user: agent.push_event_data,
account_id: account.id,
is_private: false
'conversation.typing_on', { conversation: conversation.push_event_data,
user: agent.push_event_data,
account_id: account.id,
is_private: false }
)
listener.conversation_typing_on(event)
end
@@ -83,10 +83,10 @@ describe ActionCableListener do
a_collection_containing_exactly(
admin.pubsub_token, agent.pubsub_token
),
'conversation.typing_on', conversation: conversation.push_event_data,
user: conversation.contact.push_event_data,
account_id: account.id,
is_private: false
'conversation.typing_on', { conversation: conversation.push_event_data,
user: conversation.contact.push_event_data,
account_id: account.id,
is_private: false }
)
listener.conversation_typing_on(event)
end
@@ -103,10 +103,10 @@ describe ActionCableListener do
a_collection_containing_exactly(
admin.pubsub_token, conversation.contact_inbox.pubsub_token
),
'conversation.typing_off', conversation: conversation.push_event_data,
user: agent.push_event_data,
account_id: account.id,
is_private: false
'conversation.typing_off', { conversation: conversation.push_event_data,
user: agent.push_event_data,
account_id: account.id,
is_private: false }
)
listener.conversation_typing_off(event)
end

View File

@@ -245,6 +245,7 @@ RSpec.describe SupportMailbox, type: :mailbox do
expect(conversation.messages.last.content_attributes['email']['html_content']['reply']).to include(
<<~BODY.chomp
Hi,
We are providing you platform from here you can sell paid posts on your website.
Chatwoot | CS team | [C](https://d33wubrfki0l68.cloudfront.net/973467c532160fd8b940300a43fa85fa2d060307/dc9a0/static/brand-73f58cdefae282ae74cebfa74c1d7003.svg)

View File

@@ -41,7 +41,7 @@ end
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.fixture_path = Rails.root.join('spec/fixtures')
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false