Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
65 lines
2.4 KiB
Ruby
65 lines
2.4 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe 'Installation::Onboarding API', type: :request do
|
|
let(:super_admin) { create(:super_admin) }
|
|
|
|
describe 'GET /installation/onboarding' do
|
|
context 'when CHATWOOT_INSTALLATION_ONBOARDING redis key is not set' do
|
|
it 'redirects back' do
|
|
expect(Redis::Alfred.get(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to be_nil
|
|
get '/installation/onboarding'
|
|
expect(response).to have_http_status(:redirect)
|
|
end
|
|
end
|
|
|
|
context 'when CHATWOOT_INSTALLATION_ONBOARDING redis key is set' do
|
|
it 'returns onboarding page' do
|
|
Redis::Alfred.set(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING, true)
|
|
get '/installation/onboarding'
|
|
expect(response).to have_http_status(:success)
|
|
Redis::Alfred.delete(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)
|
|
end
|
|
end
|
|
end
|
|
|
|
describe 'POST /installation/onboarding' do
|
|
let(:account_builder) { double }
|
|
|
|
before do
|
|
allow(AccountBuilder).to receive(:new).and_return(account_builder)
|
|
allow(account_builder).to receive(:perform).and_return(true)
|
|
allow(ChatwootHub).to receive(:register_instance).and_return(true)
|
|
Redis::Alfred.set(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING, true)
|
|
end
|
|
|
|
after do
|
|
Redis::Alfred.delete(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)
|
|
end
|
|
|
|
context 'when onboarding successfull' do
|
|
it 'deletes the redis key' do
|
|
post '/installation/onboarding', params: { user: {} }
|
|
expect(Redis::Alfred.get(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).to be_nil
|
|
end
|
|
|
|
it 'will not call register instance when checkboxes are unchecked' do
|
|
post '/installation/onboarding', params: { user: {} }
|
|
expect(ChatwootHub).not_to have_received(:register_instance)
|
|
end
|
|
|
|
it 'will call register instance when checkboxes are checked' do
|
|
post '/installation/onboarding', params: { user: {}, subscribe_to_updates: 1 }
|
|
expect(ChatwootHub).to have_received(:register_instance)
|
|
end
|
|
end
|
|
|
|
context 'when onboarding is not successfull' do
|
|
it 'does not deletes the redis key' do
|
|
allow(AccountBuilder).to receive(:new).and_raise('error')
|
|
post '/installation/onboarding', params: { user: {} }
|
|
expect(Redis::Alfred.get(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING)).not_to be_nil
|
|
end
|
|
end
|
|
end
|
|
end
|