Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Generate rbi for mailer classes #151

Merged
merged 6 commits into from
Sep 2, 2019
Merged

Generate rbi for mailer classes #151

merged 6 commits into from
Sep 2, 2019

Conversation

hdoan741
Copy link
Contributor

@hdoan741 hdoan741 commented Sep 2, 2019

For each instance mailing method, we detect the signature and generate the corresponding class method.

  • If a method has a sig, we'll generate a method with signature based on Sorbet's inflection data
  • If a method doesn't have one, we'll generate a method with parameters all untyped
  • The return type of a class method is ActionMailer::MessageDelivery, so that you can call "deliver_now", "deliver_later" on it.

@codecov-io
Copy link

codecov-io commented Sep 2, 2019

Codecov Report

Merging #151 into master will increase coverage by 0.11%.
The diff coverage is 99.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #151      +/-   ##
==========================================
+ Coverage   98.24%   98.36%   +0.11%     
==========================================
  Files         153      169      +16     
  Lines        1650     1830     +180     
==========================================
+ Hits         1621     1800     +179     
- Misses         29       30       +1
Impacted Files Coverage Δ
spec/mailer_rbi_formatter_spec.rb 100% <100%> (ø)
...c/support/v5.1/app/mailers/daily_prophet_mailer.rb 100% <100%> (ø)
lib/sorbet-rails/tasks/rails_rbi.rake 93.33% <100%> (+1.14%) ⬆️
...ort/v4.2/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø)
...c/support/v6.0/app/mailers/daily_prophet_mailer.rb 100% <100%> (ø)
...ort/v5.0/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø)
...ort/v6.0/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø)
...ort/v5.1/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø)
...c/support/v4.2/app/mailers/daily_prophet_mailer.rb 100% <100%> (ø)
...v5.0/config/initializers/new_framework_defaults.rb 100% <100%> (ø) ⬆️
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57e52d1...582ef02. Read the comment docs.

@hdoan741 hdoan741 merged commit ec48634 into master Sep 2, 2019
@hdoan741 hdoan741 deleted the generate_mailer_rbi branch September 2, 2019 04:29
deecewan pushed a commit to deecewan/sorbet-rails that referenced this pull request Sep 3, 2019
* first pass on the mailer & test

* implement mailer rake task

* renerate apps

* update sorbet_test_case

* update test data

* Add rake rails_rbi:mailers to README
@jaredbeck
Copy link
Contributor

Very cool, Harry! Can't wait to try it out.

Reading through the changes here was very educational for me, learning about how sorbet-rails is organized.

I have a feeling that the ability to reflect on method signatures will come in handy later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants