-
Notifications
You must be signed in to change notification settings - Fork 78
[DX] Make the test suite work without credentials or external calls #11751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davidcornu
merged 20 commits into
hackclub:main
from
davidcornu:david/push-zxmoqxwzlqwz
Sep 29, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e067d33
Fall back to temporary `ActiveRecord::Encryption` credentials in tests
davidcornu af17a9f
Add a fallback value for `TEST_URL_HOST`
davidcornu 0b39aeb
Fall back to a temporary `Lockbox` master key in tests
davidcornu 07ea4f4
Fix `undefined local variable or method 'tagged_logger'` error
davidcornu 9ea0cf7
Make the `AchTransfersController` spec work offline
davidcornu 846c28c
Use cached `EuCentralBank` exchange rates for tests
davidcornu 4e0cec6
Stub Column request in `WiresController` spec
davidcornu 9946180
Fall back to a fake Stripe API key in tests
davidcornu 5a5da05
Make `UsersController` spec work offline
davidcornu 7aaf976
Make `WiresController` spec work offline
davidcornu 6588eb5
Make `ReceiptBinMailbox` spec work offline
davidcornu 7ac53c8
Make the `TransactionEngine::Nightly` spec work offline
davidcornu 2f9b8e3
Make `Donation` spec work offline
davidcornu d6635ea
Extract `DonationSupport` and make `PayoutService::Donation::Create` …
davidcornu 7262347
Refactor `PayoutService::Invoice::Create` so stubs work
davidcornu 976c787
Make `Invoice` spec work offline
davidcornu 3710f64
Expand `Sponsor` spec to cover Stripe behaviour on creation
davidcornu 35dfc8e
Expand `StripeCardholder` spec to cover Stripe behaviour on update
davidcornu f6441b4
Refactor `InvoiceService::Create` spec and expand coverage
davidcornu e748f42
Block network calls in the test suite
davidcornu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> | ||
| <gesmes:subject>Reference rates</gesmes:subject> | ||
| <gesmes:Sender> | ||
| <gesmes:name>European Central Bank</gesmes:name> | ||
| </gesmes:Sender> | ||
| <Cube> | ||
| <Cube time='2025-09-24'> | ||
| <Cube currency='USD' rate='1.1756'/> | ||
| <Cube currency='JPY' rate='174.51'/> | ||
| <Cube currency='BGN' rate='1.9558'/> | ||
| <Cube currency='CZK' rate='24.290'/> | ||
| <Cube currency='DKK' rate='7.4639'/> | ||
| <Cube currency='GBP' rate='0.87310'/> | ||
| <Cube currency='HUF' rate='391.08'/> | ||
| <Cube currency='PLN' rate='4.2673'/> | ||
| <Cube currency='RON' rate='5.0759'/> | ||
| <Cube currency='SEK' rate='11.0350'/> | ||
| <Cube currency='CHF' rate='0.9335'/> | ||
| <Cube currency='ISK' rate='142.40'/> | ||
| <Cube currency='NOK' rate='11.6880'/> | ||
| <Cube currency='TRY' rate='48.7289'/> | ||
| <Cube currency='AUD' rate='1.7791'/> | ||
| <Cube currency='BRL' rate='6.2240'/> | ||
| <Cube currency='CAD' rate='1.6302'/> | ||
| <Cube currency='CNY' rate='8.3786'/> | ||
| <Cube currency='HKD' rate='9.1422'/> | ||
| <Cube currency='IDR' rate='19630.64'/> | ||
| <Cube currency='ILS' rate='3.9373'/> | ||
| <Cube currency='INR' rate='104.2845'/> | ||
| <Cube currency='KRW' rate='1644.99'/> | ||
| <Cube currency='MXN' rate='21.6342'/> | ||
| <Cube currency='MYR' rate='4.9493'/> | ||
| <Cube currency='NZD' rate='2.0139'/> | ||
| <Cube currency='PHP' rate='67.568'/> | ||
| <Cube currency='SGD' rate='1.5128'/> | ||
| <Cube currency='THB' rate='37.649'/> | ||
| <Cube currency='ZAR' rate='20.3339'/> | ||
| </Cube> | ||
| </Cube> | ||
| </gesmes:Envelope> |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,6 +5,9 @@ | |
| RSpec.describe ReceiptBinMailbox do | ||
| include ActionMailbox::TestHelper | ||
| include ActionMailer::TestHelper | ||
| # The helpers above expect a tagged_logger method to be present | ||
| # See https://github.com/rspec/rspec-rails/issues/2545 | ||
| attr_reader(:tagged_logger) | ||
|
|
||
| def receive_email(to:, from:, cc: nil) | ||
| receive_inbound_email_from_mail( | ||
|
|
@@ -21,6 +24,12 @@ def receive_email(to:, from:, cc: nil) | |
| ) | ||
| end | ||
|
|
||
| before do | ||
| extract_service = instance_double(ReceiptService::Extract) | ||
| expect(extract_service).to receive(:run!).and_return(nil) | ||
| expect(ReceiptService::Extract).to receive(:new).and_return(extract_service) | ||
| end | ||
|
|
||
| context "with generic addresses" do | ||
| it "finds the user based on the from address" do | ||
| user = create(:user, email: "[email protected]") | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch