sorbet-rails 0.6.5.1 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +1 -2
- data/.gitignore +2 -1
- data/.travis.yml +1 -1
- data/README.md +66 -13
- data/Rakefile +3 -3
- data/lib/bundled_rbi/customizabel_rbi_formatter.rbi +29 -0
- data/lib/bundled_rbi/pluck_to_tstruct.rbi +2 -1
- data/lib/bundled_rbi/typed_enum.rbi +7 -0
- data/lib/sorbet-rails.rb +1 -3
- data/lib/sorbet-rails/active_record_rbi_formatter.rb +6 -6
- data/lib/sorbet-rails/config.rb +12 -0
- data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +3 -0
- data/lib/sorbet-rails/dependent_gem_rbis/parlour.rbi +1896 -0
- data/lib/sorbet-rails/deprecation.rb +1 -0
- data/lib/sorbet-rails/gem_plugins/attr_json_plugin.rb +137 -0
- data/lib/sorbet-rails/gem_plugins/flag_shih_tzu_plugin.rb +201 -0
- data/lib/sorbet-rails/gem_plugins/kaminari_plugin.rb +28 -0
- data/lib/sorbet-rails/gem_plugins/shrine_plugin.rb +1 -1
- data/lib/sorbet-rails/helper_rbi_formatter.rb +1 -1
- data/lib/sorbet-rails/job_rbi_formatter.rb +75 -62
- data/lib/sorbet-rails/mailer_rbi_formatter.rb +40 -27
- data/lib/sorbet-rails/model_column_utils.rb +129 -0
- data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +40 -1
- data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +12 -112
- data/lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb +68 -0
- data/lib/sorbet-rails/model_plugins/base.rb +6 -8
- data/lib/sorbet-rails/model_plugins/plugins.rb +9 -0
- data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
- data/lib/sorbet-rails/model_utils.rb +5 -2
- data/lib/sorbet-rails/rails_mixins/generated_url_helpers.rb +2 -3
- data/lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb +54 -7
- data/lib/sorbet-rails/railtie.rb +0 -2
- data/lib/sorbet-rails/routes_rbi_formatter.rb +6 -2
- data/lib/sorbet-rails/sorbet_utils.rb +152 -150
- data/lib/sorbet-rails/tasks/rails_rbi.rake +9 -8
- data/sorbet-rails.gemspec +2 -2
- data/spec/bin/run_spec.sh +1 -1
- data/spec/generators/rails-template.rb +16 -0
- data/spec/generators/sorbet_test_cases.rb +28 -56
- data/spec/job_rbi_formatter_spec.rb +1 -1
- data/spec/pluck_to_tstruct_spec.rb +115 -16
- data/spec/rails_helper.rb +3 -7
- data/spec/rake_rails_rbi_jobs_spec.rb +20 -0
- data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
- data/spec/sorbet_spec.rb +5 -5
- data/spec/support/v5.0/Gemfile +1 -1
- data/spec/support/v5.0/Gemfile.lock +23 -19
- data/spec/support/v5.0/app/controllers/application_controller.rb +1 -1
- data/spec/support/v5.0/app/models/headmaster.rb +1 -1
- data/spec/support/v5.0/app/models/potion.rb +1 -1
- data/spec/support/v5.0/app/models/robe.rb +1 -1
- data/spec/support/v5.0/app/models/school.rb +1 -1
- data/spec/support/v5.0/app/models/spell.rb +1 -1
- data/spec/support/v5.0/app/models/subject.rb +1 -1
- data/spec/support/v5.0/app/models/wizard.rb +5 -0
- data/spec/support/v5.0/config/environments/development.rb +1 -1
- data/spec/support/v5.0/config/environments/production.rb +1 -1
- data/spec/support/v5.0/config/environments/test.rb +1 -1
- data/spec/support/v5.0/config/routes.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v5.0/db/schema.rb +8 -4
- data/spec/support/v5.0/sorbet_test_cases.rb +28 -56
- data/spec/support/v5.1/Gemfile.lock +21 -17
- data/spec/support/v5.1/app/controllers/application_controller.rb +1 -1
- data/spec/support/v5.1/app/models/headmaster.rb +1 -1
- data/spec/support/v5.1/app/models/school.rb +1 -1
- data/spec/support/v5.1/app/models/wizard.rb +5 -0
- data/spec/support/v5.1/config/environments/production.rb +1 -1
- data/spec/support/v5.1/config/routes.rb +1 -1
- data/spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v5.1/db/schema.rb +5 -1
- data/spec/support/v5.1/sorbet_test_cases.rb +28 -56
- data/spec/support/v5.2/Gemfile +1 -1
- data/spec/support/v5.2/Gemfile.lock +23 -19
- data/spec/support/v5.2/app/models/headmaster.rb +1 -1
- data/spec/support/v5.2/app/models/school.rb +1 -1
- data/spec/support/v5.2/app/models/wizard.rb +5 -0
- data/spec/support/v5.2/config/environments/development.rb +1 -1
- data/spec/support/v5.2/config/environments/production.rb +1 -1
- data/spec/support/v5.2/config/environments/test.rb +1 -1
- data/spec/support/v5.2/config/routes.rb +1 -1
- data/spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v5.2/db/schema.rb +5 -1
- data/spec/support/v5.2/sorbet_test_cases.rb +28 -56
- data/spec/support/v6.0/.gitignore +6 -0
- data/spec/support/v6.0/Gemfile +3 -3
- data/spec/support/v6.0/Gemfile.lock +89 -84
- data/spec/support/v6.0/app/models/wizard.rb +5 -0
- data/spec/support/v6.0/bin/bundle +22 -13
- data/spec/support/v6.0/config/environments/development.rb +1 -1
- data/spec/support/v6.0/config/environments/production.rb +1 -1
- data/spec/support/v6.0/config/environments/test.rb +2 -2
- data/spec/support/v6.0/config/routes.rb +1 -1
- data/spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v6.0/db/schema.rb +5 -1
- data/spec/support/v6.0/sorbet_test_cases.rb +28 -56
- data/spec/support/v6.0/tmp/pids/.keep +0 -0
- data/spec/test_data/v5.0/expected_active_record_relation.rbi +0 -1
- data/spec/test_data/v5.0/expected_application_job.rbi +2 -2
- data/spec/test_data/v5.0/expected_award_house_point_hourglasses.rbi +2 -2
- data/spec/test_data/v5.0/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v5.0/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v5.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v5.0/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v5.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v5.0/expected_headmaster.rbi +24 -0
- data/spec/test_data/v5.0/expected_potion.rbi +12 -0
- data/spec/test_data/v5.0/expected_robe.rbi +12 -0
- data/spec/test_data/v5.0/expected_routes.rbi +4 -0
- data/spec/test_data/v5.0/expected_school.rbi +12 -0
- data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +24 -0
- data/spec/test_data/v5.0/expected_spell_book.rbi +21 -9
- data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +24 -0
- data/spec/test_data/v5.0/expected_squib.rbi +63 -0
- data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +24 -0
- data/spec/test_data/v5.0/expected_wand.rbi +22 -10
- data/spec/test_data/v5.0/expected_wizard.rbi +121 -58
- data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +24 -0
- data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +121 -58
- data/spec/test_data/v5.1/expected_active_record_relation.rbi +0 -1
- data/spec/test_data/v5.1/expected_application_job.rbi +2 -2
- data/spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi +2 -2
- data/spec/test_data/v5.1/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v5.1/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v5.1/expected_headmaster.rbi +24 -0
- data/spec/test_data/v5.1/expected_potion.rbi +12 -0
- data/spec/test_data/v5.1/expected_robe.rbi +12 -0
- data/spec/test_data/v5.1/expected_routes.rbi +4 -0
- data/spec/test_data/v5.1/expected_school.rbi +12 -0
- data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +24 -0
- data/spec/test_data/v5.1/expected_spell_book.rbi +21 -9
- data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +24 -0
- data/spec/test_data/v5.1/expected_squib.rbi +63 -0
- data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +24 -0
- data/spec/test_data/v5.1/expected_wand.rbi +22 -10
- data/spec/test_data/v5.1/expected_wizard.rbi +121 -58
- data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +24 -0
- data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +121 -58
- data/spec/test_data/v5.2/expected_active_record_relation.rbi +0 -1
- data/spec/test_data/v5.2/expected_application_job.rbi +2 -2
- data/spec/test_data/v5.2/expected_attachment.rbi +24 -0
- data/spec/test_data/v5.2/expected_award_house_point_hourglasses.rbi +2 -2
- data/spec/test_data/v5.2/expected_blob.rbi +25 -1
- data/spec/test_data/v5.2/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v5.2/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v5.2/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v5.2/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v5.2/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v5.2/expected_headmaster.rbi +24 -0
- data/spec/test_data/v5.2/expected_potion.rbi +12 -0
- data/spec/test_data/v5.2/expected_robe.rbi +12 -0
- data/spec/test_data/v5.2/expected_routes.rbi +4 -0
- data/spec/test_data/v5.2/expected_school.rbi +12 -0
- data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +24 -0
- data/spec/test_data/v5.2/expected_spell_book.rbi +21 -9
- data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +24 -0
- data/spec/test_data/v5.2/expected_squib.rbi +89 -2
- data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +24 -0
- data/spec/test_data/v5.2/expected_wand.rbi +22 -10
- data/spec/test_data/v5.2/expected_wizard.rbi +147 -60
- data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +24 -0
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +147 -60
- data/spec/test_data/v6.0/expected_active_record_relation.rbi +0 -1
- data/spec/test_data/v6.0/expected_application_job.rbi +2 -2
- data/spec/test_data/v6.0/expected_attachment.rbi +24 -0
- data/spec/test_data/v6.0/expected_award_house_point_hourglasses.rbi +2 -2
- data/spec/test_data/v6.0/expected_blob.rbi +25 -1
- data/spec/test_data/v6.0/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v6.0/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v6.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v6.0/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v6.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v6.0/expected_headmaster.rbi +24 -0
- data/spec/test_data/v6.0/expected_potion.rbi +12 -0
- data/spec/test_data/v6.0/expected_robe.rbi +12 -0
- data/spec/test_data/v6.0/expected_routes.rbi +4 -0
- data/spec/test_data/v6.0/expected_school.rbi +12 -0
- data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +24 -0
- data/spec/test_data/v6.0/expected_spell_book.rbi +21 -9
- data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +24 -0
- data/spec/test_data/v6.0/expected_squib.rbi +89 -2
- data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +24 -0
- data/spec/test_data/v6.0/expected_wand.rbi +22 -10
- data/spec/test_data/v6.0/expected_wizard.rbi +147 -60
- data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +24 -0
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +147 -60
- data/spec/tstruct_comparable.rb +13 -0
- metadata +64 -15
- data/lib/bundled_rbi/parameters.rbi +0 -28
- data/lib/sorbet-rails/custom_types/boolean_string.rb +0 -42
- data/lib/sorbet-rails/custom_types/integer_string.rb +0 -45
- data/lib/sorbet-rails/rails_mixins/custom_params_methods.rb +0 -57
- data/spec/boolean_string_spec.rb +0 -59
- data/spec/custom_params_methods_spec.rb +0 -138
- data/spec/integer_string_spec.rb +0 -46
@@ -47,6 +47,11 @@ class Wizard < ApplicationRecord
|
|
47
47
|
blue: 2,
|
48
48
|
}, _prefix: :color, _suffix: :eyes
|
49
49
|
|
50
|
+
serialize :owl_results, Hash
|
51
|
+
serialize :newt_subjects # no specific data type, uses the default YAML Object coder
|
52
|
+
serialize :pets, Array
|
53
|
+
serialize :patronus_characteristics, JSON
|
54
|
+
|
50
55
|
has_one :wand
|
51
56
|
has_many :spell_books
|
52
57
|
# habtm which is optional at the db level
|
@@ -31,7 +31,7 @@ m = Module.new do
|
|
31
31
|
bundler_version = a
|
32
32
|
end
|
33
33
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
34
|
+
bundler_version = $1
|
35
35
|
update_index = i
|
36
36
|
end
|
37
37
|
bundler_version
|
@@ -61,32 +61,41 @@ m = Module.new do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def bundler_version
|
64
|
-
@bundler_version ||=
|
64
|
+
@bundler_version ||=
|
65
65
|
env_var_version || cli_arg_version ||
|
66
|
-
lockfile_version
|
67
|
-
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
68
81
|
end
|
69
82
|
|
70
83
|
def load_bundler!
|
71
84
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
85
|
|
73
|
-
|
74
|
-
activate_bundler(bundler_version.dup)
|
86
|
+
activate_bundler
|
75
87
|
end
|
76
88
|
|
77
|
-
def activate_bundler
|
78
|
-
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
-
bundler_version = "< 2"
|
80
|
-
end
|
89
|
+
def activate_bundler
|
81
90
|
gem_error = activation_error_handling do
|
82
|
-
gem "bundler",
|
91
|
+
gem "bundler", bundler_requirement
|
83
92
|
end
|
84
93
|
return if gem_error.nil?
|
85
94
|
require_error = activation_error_handling do
|
86
95
|
require "bundler/version"
|
87
96
|
end
|
88
|
-
return if require_error.nil? && Gem::Requirement.new(
|
89
|
-
warn "Activating bundler (#{
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
90
99
|
exit 42
|
91
100
|
end
|
92
101
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: false
|
2
2
|
# The test environment is used exclusively to run your application's
|
3
3
|
# test suite. You never need to work with it otherwise. Remember that
|
4
4
|
# your test database is "scratch space" for the test suite and is wiped
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Rails.application.configure do
|
8
8
|
# Settings specified here will take precedence over those in config/application.rb.
|
9
|
-
|
9
|
+
|
10
10
|
config.cache_classes = true
|
11
11
|
|
12
12
|
# Do not eager load code on boot. This avoids loading your whole application
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: true
|
2
|
+
class AddSerializedToWizards < ActiveRecord::Migration[6.0]
|
3
|
+
def change
|
4
|
+
add_column :wizards, :owl_results, :text # Hash
|
5
|
+
add_column :wizards, :newt_subjects, :text # generic
|
6
|
+
add_column :wizards, :pets, :text # Array
|
7
|
+
add_column :wizards, :patronus_characteristics, :text # serialized as JSON, but not a JSON column type
|
8
|
+
end
|
9
|
+
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 2019_06_20_000015) do
|
15
15
|
|
16
16
|
create_table "headmasters", force: :cascade do |t|
|
17
17
|
t.integer "school_id"
|
@@ -89,6 +89,10 @@ ActiveRecord::Schema.define(version: 2019_06_20_000014) do
|
|
89
89
|
t.integer "hair_length"
|
90
90
|
t.string "type", default: "Wizard", null: false
|
91
91
|
t.integer "school_id"
|
92
|
+
t.text "owl_results"
|
93
|
+
t.text "newt_subjects"
|
94
|
+
t.text "pets"
|
95
|
+
t.text "patronus_characteristics"
|
92
96
|
end
|
93
97
|
|
94
98
|
add_foreign_key "wizards", "schools"
|
@@ -305,6 +305,21 @@ T.assert_type!(Wizard::House::Hufflepuff, Wizard::House)
|
|
305
305
|
T.assert_type!(Wizard::House::Ravenclaw, Wizard::House)
|
306
306
|
T.assert_type!(Wizard::House::Slytherin, Wizard::House)
|
307
307
|
|
308
|
+
# Serialization
|
309
|
+
T.assert_type!(
|
310
|
+
wizard.owl_results,
|
311
|
+
T.nilable(T::Hash[T.untyped, T.untyped])
|
312
|
+
)
|
313
|
+
T.assert_type!(
|
314
|
+
wizard.newt_subjects,
|
315
|
+
T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[T.untyped, T.untyped], Integer, String))
|
316
|
+
)
|
317
|
+
T.assert_type!(
|
318
|
+
wizard.patronus_characteristics,
|
319
|
+
T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[String, T.untyped], Integer, String))
|
320
|
+
)
|
321
|
+
T.assert_type!(wizard.pets, T.nilable(T::Array[T.untyped]))
|
322
|
+
|
308
323
|
# Mythical plugin
|
309
324
|
T.assert_type!(Wand.mythicals, T::Array[Wand])
|
310
325
|
|
@@ -312,7 +327,10 @@ T.assert_type!(Wand.mythicals, T::Array[Wand])
|
|
312
327
|
T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
|
313
328
|
|
314
329
|
# Jobs
|
315
|
-
|
330
|
+
T.assert_type!(
|
331
|
+
AwardHousePointHourglasses.perform_later(student: wizard, point: 10),
|
332
|
+
AwardHousePointHourglasses
|
333
|
+
)
|
316
334
|
AwardHousePointHourglasses.perform_now(student: wizard, point: 10)
|
317
335
|
AwardHousePointHourglasses.
|
318
336
|
set(queue: :daily, wait: 5.minutes).
|
@@ -321,7 +339,6 @@ AwardHousePointHourglasses.
|
|
321
339
|
set(priority: 10, wait_until: Time.now.tomorrow).
|
322
340
|
perform_later(student: wizard, point: 10)
|
323
341
|
|
324
|
-
|
325
342
|
T.assert_type!(wizard.broom_nimbus?, T::Boolean)
|
326
343
|
T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
|
327
344
|
T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
|
@@ -361,44 +378,6 @@ params = ActionController::Parameters.new({
|
|
361
378
|
typed_params = TypedParams[MyActionParams].new.extract!(params)
|
362
379
|
T.assert_type!(typed_params, MyActionParams)
|
363
380
|
|
364
|
-
# -- require_typed
|
365
|
-
T.assert_type!(
|
366
|
-
params.require_typed(:age, TA[Integer].new),
|
367
|
-
Integer,
|
368
|
-
)
|
369
|
-
T.assert_type!(
|
370
|
-
params.require_typed(:name, TA[String].new),
|
371
|
-
String,
|
372
|
-
)
|
373
|
-
info = params.require_typed(:info, TA[ActionController::Parameters].new)
|
374
|
-
T.assert_type!(info, ActionController::Parameters)
|
375
|
-
T.assert_type!(
|
376
|
-
info.require_typed(:friends, TA[T::Array[String]].new),
|
377
|
-
T::Array[String],
|
378
|
-
)
|
379
|
-
# -- fetch_typed
|
380
|
-
T.assert_type!(
|
381
|
-
params.fetch_typed(:age, TA[Integer].new),
|
382
|
-
Integer,
|
383
|
-
)
|
384
|
-
T.assert_type!(
|
385
|
-
params.fetch_typed(:name, TA[String].new),
|
386
|
-
String,
|
387
|
-
)
|
388
|
-
T.assert_type!(
|
389
|
-
params.fetch_typed(:nonexistence, TA[String].new, ''),
|
390
|
-
String,
|
391
|
-
)
|
392
|
-
T.assert_type!(
|
393
|
-
params.fetch_typed(:nonexistence, TA[T.nilable(String)].new, nil),
|
394
|
-
T.nilable(String),
|
395
|
-
)
|
396
|
-
T.assert_type!(
|
397
|
-
params.fetch_typed(:nonexistence, TA[T::Array[Integer]].new, []),
|
398
|
-
T::Array[Integer],
|
399
|
-
)
|
400
|
-
|
401
|
-
|
402
381
|
# -- pluck to tstruct
|
403
382
|
class WizardStruct < T::Struct
|
404
383
|
const :name, String
|
@@ -415,23 +394,16 @@ Wizard.all.pluck_to_tstruct(TA[WizardStruct].new).each do |row|
|
|
415
394
|
T.assert_type!(row, WizardStruct)
|
416
395
|
end
|
417
396
|
|
418
|
-
|
419
397
|
# -- GeneratedUrlHelpers
|
420
398
|
class TestHelper
|
421
399
|
include GeneratedUrlHelpers
|
422
|
-
|
423
|
-
# need to implement this for the url
|
424
|
-
def default_url_options
|
425
|
-
{
|
426
|
-
protocol: 'http',
|
427
|
-
host: 'localhost',
|
428
|
-
port: 3000,
|
429
|
-
}
|
430
|
-
end
|
431
|
-
|
432
|
-
def test_url_helper
|
433
|
-
T.assert_type!(test_index_path, String)
|
434
|
-
T.assert_type!(test_index_url, String)
|
435
|
-
end
|
436
400
|
end
|
437
|
-
|
401
|
+
|
402
|
+
T.assert_type!(TestHelper.new.test_index_path, String)
|
403
|
+
# need to set this config for _url methods
|
404
|
+
Rails.application.routes.default_url_options = {
|
405
|
+
protocol: 'http',
|
406
|
+
host: 'localhost',
|
407
|
+
port: 3000,
|
408
|
+
}
|
409
|
+
T.assert_type!(TestHelper.new.test_index_url, String)
|
File without changes
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# This is an autogenerated file for Rails' jobs.
|
3
3
|
# Please rerun bundle exec rake rails_rbi:jobs to regenerate.
|
4
4
|
class ApplicationJob
|
5
|
-
sig { params(_: T.untyped).
|
5
|
+
sig { params(_: T.untyped).returns(ApplicationJob) }
|
6
6
|
def self.perform_later(*_); end
|
7
7
|
|
8
|
-
sig { params(_: T.untyped).
|
8
|
+
sig { params(_: T.untyped).returns(ApplicationJob) }
|
9
9
|
def self.perform_now(*_); end
|
10
10
|
|
11
11
|
sig do
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# This is an autogenerated file for Rails' jobs.
|
3
3
|
# Please rerun bundle exec rake rails_rbi:jobs to regenerate.
|
4
4
|
class AwardHousePointHourglasses
|
5
|
-
sig { params(student: Wizard, point: Integer).
|
5
|
+
sig { params(student: Wizard, point: Integer).returns(AwardHousePointHourglasses) }
|
6
6
|
def self.perform_later(student:, point:); end
|
7
7
|
|
8
|
-
sig { params(student: Wizard, point: Integer).
|
8
|
+
sig { params(student: Wizard, point: Integer).returns(AwardHousePointHourglasses) }
|
9
9
|
def self.perform_now(student:, point:); end
|
10
10
|
|
11
11
|
sig do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# == Custom Generator ==
|
3
|
+
# This is an autogenerated file for Rails' jobs.
|
4
|
+
# Please rerun bundle exec rake rails_rbi:jobs to regenerate.
|
5
|
+
class ApplicationJob
|
6
|
+
sig { params(_: T.untyped).returns(ApplicationJob) }
|
7
|
+
def self.perform_later(*_); end
|
8
|
+
|
9
|
+
sig { params(_: T.untyped).returns(ApplicationJob) }
|
10
|
+
def self.perform_now(*_); end
|
11
|
+
|
12
|
+
sig do
|
13
|
+
params(
|
14
|
+
wait: T.nilable(ActiveSupport::Duration),
|
15
|
+
wait_until: T.nilable(T.any(ActiveSupport::TimeWithZone, Date, Time)),
|
16
|
+
queue: T.nilable(T.any(String, Symbol)),
|
17
|
+
priority: T.nilable(Integer)
|
18
|
+
).returns(T.self_type)
|
19
|
+
end
|
20
|
+
def self.set(wait: nil, wait_until: nil, queue: nil, priority: nil); end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# == Custom Generator ==
|
3
|
+
# This is an autogenerated file for Rails' jobs.
|
4
|
+
# Please rerun bundle exec rake rails_rbi:jobs to regenerate.
|
5
|
+
class AwardHousePointHourglasses
|
6
|
+
sig { params(student: Wizard, point: Integer).returns(AwardHousePointHourglasses) }
|
7
|
+
def self.perform_later(student:, point:); end
|
8
|
+
|
9
|
+
sig { params(student: Wizard, point: Integer).returns(AwardHousePointHourglasses) }
|
10
|
+
def self.perform_now(student:, point:); end
|
11
|
+
|
12
|
+
sig do
|
13
|
+
params(
|
14
|
+
wait: T.nilable(ActiveSupport::Duration),
|
15
|
+
wait_until: T.nilable(T.any(ActiveSupport::TimeWithZone, Date, Time)),
|
16
|
+
queue: T.nilable(T.any(String, Symbol)),
|
17
|
+
priority: T.nilable(Integer)
|
18
|
+
).returns(T.self_type)
|
19
|
+
end
|
20
|
+
def self.set(wait: nil, wait_until: nil, queue: nil, priority: nil); end
|
21
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# == Custom Generator ==
|
3
|
+
# This is an autogenerated file for Rails' mailers.
|
4
|
+
# Please rerun bundle exec rake rails_rbi:mailers to regenerate.
|
5
|
+
class DailyProphetMailer
|
6
|
+
sig { params(wizards: T::Array[Wizard], hotnews_only: T::Boolean).returns(ActionMailer::MessageDelivery) }
|
7
|
+
def self.notify_subscribers(wizards:, hotnews_only:); end
|
8
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# == Custom Generator ==
|
3
|
+
# This is an autogenerated file for Rails' mailers.
|
4
|
+
# Please rerun bundle exec rake rails_rbi:mailers to regenerate.
|
5
|
+
class HogwartsAcceptanceMailer
|
6
|
+
sig { params(student: Wizard).returns(ActionMailer::MessageDelivery) }
|
7
|
+
def self.notify(student); end
|
8
|
+
|
9
|
+
sig { params(student: T.untyped).returns(ActionMailer::MessageDelivery) }
|
10
|
+
def self.notify_retry(student); end
|
11
|
+
|
12
|
+
sig do
|
13
|
+
params(
|
14
|
+
teacher: Wizard,
|
15
|
+
note: String,
|
16
|
+
student: Wizard,
|
17
|
+
special: T::Boolean
|
18
|
+
).returns(ActionMailer::MessageDelivery)
|
19
|
+
end
|
20
|
+
def self.notify_teacher(teacher, note = nil, student:, special: false); end
|
21
|
+
end
|
@@ -40,14 +40,38 @@ module Headmaster::GeneratedAssociationMethods
|
|
40
40
|
sig { returns(::School) }
|
41
41
|
def school; end
|
42
42
|
|
43
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::School).void)).returns(::School) }
|
44
|
+
def build_school(*args, &block); end
|
45
|
+
|
46
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::School).void)).returns(::School) }
|
47
|
+
def create_school(*args, &block); end
|
48
|
+
|
49
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::School).void)).returns(::School) }
|
50
|
+
def create_school!(*args, &block); end
|
51
|
+
|
43
52
|
sig { params(value: ::School).void }
|
44
53
|
def school=(value); end
|
45
54
|
|
55
|
+
sig { returns(::School) }
|
56
|
+
def reload_school; end
|
57
|
+
|
46
58
|
sig { returns(::Wizard) }
|
47
59
|
def wizard; end
|
48
60
|
|
61
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
62
|
+
def build_wizard(*args, &block); end
|
63
|
+
|
64
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
65
|
+
def create_wizard(*args, &block); end
|
66
|
+
|
67
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
68
|
+
def create_wizard!(*args, &block); end
|
69
|
+
|
49
70
|
sig { params(value: ::Wizard).void }
|
50
71
|
def wizard=(value); end
|
72
|
+
|
73
|
+
sig { returns(::Wizard) }
|
74
|
+
def reload_wizard; end
|
51
75
|
end
|
52
76
|
|
53
77
|
module Headmaster::CustomFinderMethods
|
@@ -11,8 +11,20 @@ module Potion::GeneratedAssociationMethods
|
|
11
11
|
sig { returns(T.nilable(::Wizard)) }
|
12
12
|
def wizard; end
|
13
13
|
|
14
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
15
|
+
def build_wizard(*args, &block); end
|
16
|
+
|
17
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
18
|
+
def create_wizard(*args, &block); end
|
19
|
+
|
20
|
+
sig { params(args: T.untyped, block: T.nilable(T.proc.params(object: ::Wizard).void)).returns(::Wizard) }
|
21
|
+
def create_wizard!(*args, &block); end
|
22
|
+
|
14
23
|
sig { params(value: T.nilable(::Wizard)).void }
|
15
24
|
def wizard=(value); end
|
25
|
+
|
26
|
+
sig { returns(T.nilable(::Wizard)) }
|
27
|
+
def reload_wizard; end
|
16
28
|
end
|
17
29
|
|
18
30
|
module Potion::CustomFinderMethods
|