-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Motivation ---------- It took me a while to debug the 404 error when clicking on the link to: ``` http://localhost:3000/onboarding/whats-app?jwt=eyJhbGc ``` I was expecting to see a problem in `config/routes.rb` but couldn't find anything. It was surprising to me that we programmatically throw a 404 in one of the controllers. How to test ----------- 1. `bin/rspec ./spec/adapters/signal_adapter/api_spec.rb` 2. Tests pass Requested changes ----------------- @mattwr18 asked me to implement this consistently across our codebase. I have seen this only once, here's the commit that introduced it: 9a541d6. Thankfully there is already a test (that still fails if you remove conditional routing). In the tests there was: ``` unless Setting.signal_server_phone_number allow(Setting).to receive(:signal_server_phone_number).and_return('SIGNAL_SERVER_PHONE_NUMBER') # .. end ``` from 07694a6. @mattwr18 this looks intentional, why was that? Did I miss anything?
- Loading branch information
1 parent
ec91646
commit b92128b
Showing
6 changed files
with
53 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'Onboarding::Whatsapp', type: :routing do | ||
describe 'GET /onboarding/whatsapp' do | ||
subject { { get: '/onboarding/whats-app' } } | ||
|
||
describe 'when no Whatsapp number was configured' do | ||
before { allow(Setting).to receive(:whats_app_server_phone_number).and_return('') } | ||
it { should_not be_routable } | ||
end | ||
|
||
describe 'but when a Whatsapp number was configured' do | ||
before { allow(Setting).to receive(:whats_app_server_phone_number).and_return('+49123456789') } | ||
it { should be_routable } | ||
end | ||
end | ||
|
||
describe 'POST /onboarding/whatsapp' do | ||
subject { { post: '/onboarding/whats-app' } } | ||
|
||
describe 'when no Whatsapp number was configured' do | ||
before { allow(Setting).to receive(:whats_app_server_phone_number).and_return('') } | ||
it { should_not be_routable } | ||
end | ||
|
||
describe 'but when a Whatsapp number was configured' do | ||
before { allow(Setting).to receive(:whats_app_server_phone_number).and_return('+49123456789') } | ||
it { should be_routable } | ||
end | ||
end | ||
end |