sorbet-rails 0.6.3 → 0.7.1
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 +3 -1
- data/README.md +54 -7
- 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 +8 -2
- data/lib/sorbet-rails/config.rb +11 -0
- data/lib/sorbet-rails/deprecation.rb +1 -0
- data/lib/sorbet-rails/gem_plugins/active_flag_plugin.rb +0 -1
- data/lib/sorbet-rails/gem_plugins/kaminari_plugin.rb +8 -0
- data/lib/sorbet-rails/gem_plugins/paperclip_plugin.rb +0 -1
- data/lib/sorbet-rails/job_rbi_formatter.rb +73 -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 +37 -3
- data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +0 -103
- data/lib/sorbet-rails/model_plugins/active_record_enum.rb +0 -1
- data/lib/sorbet-rails/model_plugins/active_record_named_scope.rb +15 -6
- data/lib/sorbet-rails/model_plugins/active_record_querying.rb +34 -3
- data/lib/sorbet-rails/model_plugins/active_storage_methods.rb +1 -1
- data/lib/sorbet-rails/model_plugins/base.rb +0 -9
- data/lib/sorbet-rails/model_rbi_formatter.rb +4 -8
- data/lib/sorbet-rails/model_utils.rb +73 -32
- data/lib/sorbet-rails/rails_mixins/generated_url_helpers.rb +2 -3
- data/lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb +17 -7
- data/lib/sorbet-rails/railtie.rb +0 -2
- data/lib/sorbet-rails/sorbet_utils.rb +152 -150
- data/lib/sorbet-rails/tasks/rails_rbi.rake +18 -26
- data/sorbet-rails.gemspec +1 -1
- data/spec/generators/rails-template.rb +3 -6
- data/spec/generators/sorbet_test_cases.rb +66 -88
- data/spec/job_rbi_formatter_spec.rb +1 -1
- data/spec/pluck_to_tstruct_spec.rb +74 -1
- data/spec/rails_helper.rb +2 -2
- data/spec/rake_rails_rbi_jobs_spec.rb +20 -0
- data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
- data/spec/support/v5.0/Gemfile +1 -1
- data/spec/support/v5.0/Gemfile.lock +9 -9
- data/spec/support/v5.0/app/models/spell_book.rb +2 -0
- data/spec/support/v5.0/app/models/wizard.rb +1 -1
- data/spec/support/v5.0/sorbet_test_cases.rb +66 -88
- data/spec/support/v5.1/Gemfile.lock +7 -7
- data/spec/support/v5.1/app/models/spell_book.rb +2 -0
- data/spec/support/v5.1/app/models/wizard.rb +1 -1
- data/spec/support/v5.1/sorbet_test_cases.rb +66 -88
- data/spec/support/v5.2/Gemfile +1 -1
- data/spec/support/v5.2/Gemfile.lock +9 -9
- data/spec/support/v5.2/app/models/spell_book.rb +2 -0
- data/spec/support/v5.2/app/models/wizard.rb +1 -1
- data/spec/support/v5.2/sorbet_test_cases.rb +66 -88
- data/spec/support/v6.0/.gitignore +6 -0
- data/spec/support/v6.0/Gemfile +3 -3
- data/spec/support/v6.0/Gemfile.lock +77 -76
- data/spec/support/v6.0/app/models/spell_book.rb +2 -0
- data/spec/support/v6.0/app/models/wizard.rb +1 -1
- data/spec/support/v6.0/bin/bundle +22 -13
- data/spec/support/v6.0/config/environments/test.rb +1 -1
- data/spec/support/v6.0/sorbet_test_cases.rb +66 -88
- data/spec/support/v6.0/tmp/pids/.keep +0 -0
- data/spec/test_data/v5.0/expected_active_record_base.rbi +2 -2
- data/spec/test_data/v5.0/expected_active_record_relation.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 +60 -190
- data/spec/test_data/v5.0/expected_internal_metadata.rbi +42 -188
- data/spec/test_data/v5.0/expected_potion.rbi +51 -188
- data/spec/test_data/v5.0/expected_robe.rbi +51 -190
- data/spec/test_data/v5.0/expected_schema_migration.rbi +42 -188
- data/spec/test_data/v5.0/expected_school.rbi +51 -190
- data/spec/test_data/v5.0/expected_spell.rbi +42 -190
- data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +60 -190
- data/spec/test_data/v5.0/expected_spell_book.rbi +86 -215
- data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +60 -190
- data/spec/test_data/v5.0/expected_squib.rbi +131 -263
- data/spec/test_data/v5.0/expected_subject.rbi +42 -190
- data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +60 -190
- data/spec/test_data/v5.0/expected_wand.rbi +84 -225
- data/spec/test_data/v5.0/expected_wizard.rbi +131 -263
- data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +60 -190
- data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +131 -263
- data/spec/test_data/v5.1/expected_active_record_base.rbi +2 -2
- data/spec/test_data/v5.1/expected_active_record_relation.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 +60 -196
- data/spec/test_data/v5.1/expected_internal_metadata.rbi +42 -194
- data/spec/test_data/v5.1/expected_potion.rbi +51 -194
- data/spec/test_data/v5.1/expected_robe.rbi +51 -196
- data/spec/test_data/v5.1/expected_schema_migration.rbi +42 -194
- data/spec/test_data/v5.1/expected_school.rbi +51 -196
- data/spec/test_data/v5.1/expected_spell.rbi +42 -196
- data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +60 -196
- data/spec/test_data/v5.1/expected_spell_book.rbi +86 -221
- data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +60 -196
- data/spec/test_data/v5.1/expected_squib.rbi +132 -270
- data/spec/test_data/v5.1/expected_subject.rbi +42 -196
- data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +60 -196
- data/spec/test_data/v5.1/expected_wand.rbi +84 -231
- data/spec/test_data/v5.1/expected_wizard.rbi +132 -270
- data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +60 -196
- data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +132 -270
- data/spec/test_data/v5.2/expected_active_record_base.rbi +2 -2
- data/spec/test_data/v5.2/expected_active_record_relation.rbi +2 -2
- data/spec/test_data/v5.2/expected_attachment.rbi +60 -194
- data/spec/test_data/v5.2/expected_blob.rbi +80 -214
- 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 +60 -196
- data/spec/test_data/v5.2/expected_internal_metadata.rbi +42 -194
- data/spec/test_data/v5.2/expected_potion.rbi +51 -194
- data/spec/test_data/v5.2/expected_robe.rbi +51 -196
- data/spec/test_data/v5.2/expected_schema_migration.rbi +42 -194
- data/spec/test_data/v5.2/expected_school.rbi +51 -196
- data/spec/test_data/v5.2/expected_spell.rbi +42 -196
- data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +60 -196
- data/spec/test_data/v5.2/expected_spell_book.rbi +86 -221
- data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +60 -196
- data/spec/test_data/v5.2/expected_squib.rbi +156 -276
- data/spec/test_data/v5.2/expected_subject.rbi +42 -196
- data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +60 -196
- data/spec/test_data/v5.2/expected_wand.rbi +84 -231
- data/spec/test_data/v5.2/expected_wizard.rbi +156 -276
- data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +60 -196
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +156 -276
- data/spec/test_data/v6.0/expected_active_record_base.rbi +2 -2
- data/spec/test_data/v6.0/expected_active_record_relation.rbi +10 -10
- data/spec/test_data/v6.0/expected_attachment.rbi +60 -218
- data/spec/test_data/v6.0/expected_blob.rbi +80 -238
- 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 +60 -220
- data/spec/test_data/v6.0/expected_internal_metadata.rbi +42 -218
- data/spec/test_data/v6.0/expected_potion.rbi +51 -218
- data/spec/test_data/v6.0/expected_robe.rbi +51 -220
- data/spec/test_data/v6.0/expected_routes.rbi +14 -7
- data/spec/test_data/v6.0/expected_schema_migration.rbi +42 -218
- data/spec/test_data/v6.0/expected_school.rbi +51 -220
- data/spec/test_data/v6.0/expected_spell.rbi +42 -220
- data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +60 -220
- data/spec/test_data/v6.0/expected_spell_book.rbi +98 -257
- data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +60 -220
- data/spec/test_data/v6.0/expected_squib.rbi +182 -326
- data/spec/test_data/v6.0/expected_subject.rbi +42 -220
- data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +60 -220
- data/spec/test_data/v6.0/expected_wand.rbi +100 -271
- data/spec/test_data/v6.0/expected_wizard.rbi +182 -326
- data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +60 -220
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +182 -326
- metadata +46 -11
- 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
@@ -10,6 +10,7 @@
|
|
10
10
|
# Ignore the default SQLite database.
|
11
11
|
/db/*.sqlite3
|
12
12
|
/db/*.sqlite3-journal
|
13
|
+
/db/*.sqlite3-*
|
13
14
|
|
14
15
|
# Ignore all logfiles and tempfiles.
|
15
16
|
/log/*
|
@@ -17,6 +18,11 @@
|
|
17
18
|
!/log/.keep
|
18
19
|
!/tmp/.keep
|
19
20
|
|
21
|
+
# Ignore pidfiles, but keep the directory.
|
22
|
+
/tmp/pids/*
|
23
|
+
!/tmp/pids/
|
24
|
+
!/tmp/pids/.keep
|
25
|
+
|
20
26
|
# Ignore uploaded files in development.
|
21
27
|
/storage/*
|
22
28
|
!/storage/.keep
|
data/spec/support/v6.0/Gemfile
CHANGED
@@ -4,11 +4,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
4
4
|
ruby '2.5.5'
|
5
5
|
|
6
6
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
7
|
-
gem 'rails', '~> 6.0.
|
7
|
+
gem 'rails', '~> 6.0.3'
|
8
8
|
# Use sqlite3 as the database for Active Record
|
9
9
|
gem 'sqlite3', '~> 1.4'
|
10
10
|
# Use Puma as the app server
|
11
|
-
gem 'puma', '~>
|
11
|
+
gem 'puma', '~> 4.1'
|
12
12
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
13
13
|
gem 'jbuilder', '~> 2.7'
|
14
14
|
# Use Active Model has_secure_password
|
@@ -32,4 +32,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
|
32
32
|
|
33
33
|
gem 'sorbet-rails', path: '../../../.'
|
34
34
|
gem 'sorbet'
|
35
|
-
gem 'sorbet-runtime'
|
35
|
+
gem 'sorbet-runtime'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../..
|
3
3
|
specs:
|
4
|
-
sorbet-rails (0.
|
4
|
+
sorbet-rails (0.7.1)
|
5
5
|
method_source (>= 0.9.2)
|
6
6
|
parlour (~> 2.0)
|
7
7
|
parser (>= 2.7)
|
@@ -11,65 +11,65 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actioncable (6.0.
|
15
|
-
actionpack (= 6.0.
|
14
|
+
actioncable (6.0.3.2)
|
15
|
+
actionpack (= 6.0.3.2)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (6.0.
|
19
|
-
actionpack (= 6.0.
|
20
|
-
activejob (= 6.0.
|
21
|
-
activerecord (= 6.0.
|
22
|
-
activestorage (= 6.0.
|
23
|
-
activesupport (= 6.0.
|
18
|
+
actionmailbox (6.0.3.2)
|
19
|
+
actionpack (= 6.0.3.2)
|
20
|
+
activejob (= 6.0.3.2)
|
21
|
+
activerecord (= 6.0.3.2)
|
22
|
+
activestorage (= 6.0.3.2)
|
23
|
+
activesupport (= 6.0.3.2)
|
24
24
|
mail (>= 2.7.1)
|
25
|
-
actionmailer (6.0.
|
26
|
-
actionpack (= 6.0.
|
27
|
-
actionview (= 6.0.
|
28
|
-
activejob (= 6.0.
|
25
|
+
actionmailer (6.0.3.2)
|
26
|
+
actionpack (= 6.0.3.2)
|
27
|
+
actionview (= 6.0.3.2)
|
28
|
+
activejob (= 6.0.3.2)
|
29
29
|
mail (~> 2.5, >= 2.5.4)
|
30
30
|
rails-dom-testing (~> 2.0)
|
31
|
-
actionpack (6.0.
|
32
|
-
actionview (= 6.0.
|
33
|
-
activesupport (= 6.0.
|
31
|
+
actionpack (6.0.3.2)
|
32
|
+
actionview (= 6.0.3.2)
|
33
|
+
activesupport (= 6.0.3.2)
|
34
34
|
rack (~> 2.0, >= 2.0.8)
|
35
35
|
rack-test (>= 0.6.3)
|
36
36
|
rails-dom-testing (~> 2.0)
|
37
37
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
38
|
-
actiontext (6.0.
|
39
|
-
actionpack (= 6.0.
|
40
|
-
activerecord (= 6.0.
|
41
|
-
activestorage (= 6.0.
|
42
|
-
activesupport (= 6.0.
|
38
|
+
actiontext (6.0.3.2)
|
39
|
+
actionpack (= 6.0.3.2)
|
40
|
+
activerecord (= 6.0.3.2)
|
41
|
+
activestorage (= 6.0.3.2)
|
42
|
+
activesupport (= 6.0.3.2)
|
43
43
|
nokogiri (>= 1.8.5)
|
44
|
-
actionview (6.0.
|
45
|
-
activesupport (= 6.0.
|
44
|
+
actionview (6.0.3.2)
|
45
|
+
activesupport (= 6.0.3.2)
|
46
46
|
builder (~> 3.1)
|
47
47
|
erubi (~> 1.4)
|
48
48
|
rails-dom-testing (~> 2.0)
|
49
49
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
50
|
-
activejob (6.0.
|
51
|
-
activesupport (= 6.0.
|
50
|
+
activejob (6.0.3.2)
|
51
|
+
activesupport (= 6.0.3.2)
|
52
52
|
globalid (>= 0.3.6)
|
53
|
-
activemodel (6.0.
|
54
|
-
activesupport (= 6.0.
|
55
|
-
activerecord (6.0.
|
56
|
-
activemodel (= 6.0.
|
57
|
-
activesupport (= 6.0.
|
58
|
-
activestorage (6.0.
|
59
|
-
actionpack (= 6.0.
|
60
|
-
activejob (= 6.0.
|
61
|
-
activerecord (= 6.0.
|
53
|
+
activemodel (6.0.3.2)
|
54
|
+
activesupport (= 6.0.3.2)
|
55
|
+
activerecord (6.0.3.2)
|
56
|
+
activemodel (= 6.0.3.2)
|
57
|
+
activesupport (= 6.0.3.2)
|
58
|
+
activestorage (6.0.3.2)
|
59
|
+
actionpack (= 6.0.3.2)
|
60
|
+
activejob (= 6.0.3.2)
|
61
|
+
activerecord (= 6.0.3.2)
|
62
62
|
marcel (~> 0.3.1)
|
63
|
-
activesupport (6.0.
|
63
|
+
activesupport (6.0.3.2)
|
64
64
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
65
|
i18n (>= 0.7, < 2)
|
66
66
|
minitest (~> 5.1)
|
67
67
|
tzinfo (~> 1.1)
|
68
|
-
zeitwerk (~> 2.2)
|
69
|
-
ast (2.4.
|
68
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
69
|
+
ast (2.4.1)
|
70
70
|
bindex (0.8.1)
|
71
71
|
builder (3.2.4)
|
72
|
-
byebug (11.1.
|
72
|
+
byebug (11.1.3)
|
73
73
|
commander (4.5.2)
|
74
74
|
highline (~> 2.0.0)
|
75
75
|
concurrent-ruby (1.1.6)
|
@@ -78,11 +78,11 @@ GEM
|
|
78
78
|
globalid (0.4.2)
|
79
79
|
activesupport (>= 4.2.0)
|
80
80
|
highline (2.0.3)
|
81
|
-
i18n (1.8.
|
81
|
+
i18n (1.8.3)
|
82
82
|
concurrent-ruby (~> 1.0)
|
83
83
|
jbuilder (2.10.0)
|
84
84
|
activesupport (>= 5.0.0)
|
85
|
-
loofah (2.
|
85
|
+
loofah (2.6.0)
|
86
86
|
crass (~> 1.0.2)
|
87
87
|
nokogiri (>= 1.5.9)
|
88
88
|
mail (2.7.1)
|
@@ -90,64 +90,65 @@ GEM
|
|
90
90
|
marcel (0.3.3)
|
91
91
|
mimemagic (~> 0.3.2)
|
92
92
|
method_source (1.0.0)
|
93
|
-
mimemagic (0.3.
|
93
|
+
mimemagic (0.3.5)
|
94
94
|
mini_mime (1.0.2)
|
95
95
|
mini_portile2 (2.4.0)
|
96
|
-
minitest (5.14.
|
96
|
+
minitest (5.14.1)
|
97
97
|
nio4r (2.5.2)
|
98
|
-
nokogiri (1.10.
|
98
|
+
nokogiri (1.10.10)
|
99
99
|
mini_portile2 (~> 2.4.0)
|
100
100
|
parlour (2.1.0)
|
101
101
|
commander (~> 4.5)
|
102
102
|
parser
|
103
103
|
rainbow (~> 3.0)
|
104
104
|
sorbet-runtime (>= 0.5)
|
105
|
-
parser (2.7.1.
|
106
|
-
ast (~> 2.4.
|
105
|
+
parser (2.7.1.4)
|
106
|
+
ast (~> 2.4.1)
|
107
107
|
polyfill (1.8.0)
|
108
|
-
puma (3.
|
109
|
-
|
108
|
+
puma (4.3.5)
|
109
|
+
nio4r (~> 2.0)
|
110
|
+
rack (2.2.3)
|
110
111
|
rack-test (1.1.0)
|
111
112
|
rack (>= 1.0, < 3)
|
112
|
-
rails (6.0.
|
113
|
-
actioncable (= 6.0.
|
114
|
-
actionmailbox (= 6.0.
|
115
|
-
actionmailer (= 6.0.
|
116
|
-
actionpack (= 6.0.
|
117
|
-
actiontext (= 6.0.
|
118
|
-
actionview (= 6.0.
|
119
|
-
activejob (= 6.0.
|
120
|
-
activemodel (= 6.0.
|
121
|
-
activerecord (= 6.0.
|
122
|
-
activestorage (= 6.0.
|
123
|
-
activesupport (= 6.0.
|
113
|
+
rails (6.0.3.2)
|
114
|
+
actioncable (= 6.0.3.2)
|
115
|
+
actionmailbox (= 6.0.3.2)
|
116
|
+
actionmailer (= 6.0.3.2)
|
117
|
+
actionpack (= 6.0.3.2)
|
118
|
+
actiontext (= 6.0.3.2)
|
119
|
+
actionview (= 6.0.3.2)
|
120
|
+
activejob (= 6.0.3.2)
|
121
|
+
activemodel (= 6.0.3.2)
|
122
|
+
activerecord (= 6.0.3.2)
|
123
|
+
activestorage (= 6.0.3.2)
|
124
|
+
activesupport (= 6.0.3.2)
|
124
125
|
bundler (>= 1.3.0)
|
125
|
-
railties (= 6.0.
|
126
|
+
railties (= 6.0.3.2)
|
126
127
|
sprockets-rails (>= 2.0.0)
|
127
128
|
rails-dom-testing (2.0.3)
|
128
129
|
activesupport (>= 4.2.0)
|
129
130
|
nokogiri (>= 1.6)
|
130
131
|
rails-html-sanitizer (1.3.0)
|
131
132
|
loofah (~> 2.3)
|
132
|
-
railties (6.0.
|
133
|
-
actionpack (= 6.0.
|
134
|
-
activesupport (= 6.0.
|
133
|
+
railties (6.0.3.2)
|
134
|
+
actionpack (= 6.0.3.2)
|
135
|
+
activesupport (= 6.0.3.2)
|
135
136
|
method_source
|
136
137
|
rake (>= 0.8.7)
|
137
138
|
thor (>= 0.20.3, < 2.0)
|
138
139
|
rainbow (3.0.0)
|
139
140
|
rake (13.0.1)
|
140
141
|
safe_type (1.1.1)
|
141
|
-
sorbet (0.5.
|
142
|
-
sorbet-static (= 0.5.
|
143
|
-
sorbet-coerce (0.2.
|
142
|
+
sorbet (0.5.5815)
|
143
|
+
sorbet-static (= 0.5.5815)
|
144
|
+
sorbet-coerce (0.2.7)
|
144
145
|
polyfill (~> 1.8)
|
145
146
|
safe_type (~> 1.1, >= 1.1.1)
|
146
147
|
sorbet (>= 0.4.4704)
|
147
148
|
sorbet-runtime (>= 0.4.4704)
|
148
|
-
sorbet-runtime (0.5.
|
149
|
-
sorbet-static (0.5.
|
150
|
-
sprockets (4.0.
|
149
|
+
sorbet-runtime (0.5.5815)
|
150
|
+
sorbet-static (0.5.5815-universal-darwin-14)
|
151
|
+
sprockets (4.0.2)
|
151
152
|
concurrent-ruby (~> 1.0)
|
152
153
|
rack (> 1, < 3)
|
153
154
|
sprockets-rails (3.2.1)
|
@@ -157,17 +158,17 @@ GEM
|
|
157
158
|
sqlite3 (1.4.2)
|
158
159
|
thor (1.0.1)
|
159
160
|
thread_safe (0.3.6)
|
160
|
-
tzinfo (1.2.
|
161
|
+
tzinfo (1.2.7)
|
161
162
|
thread_safe (~> 0.1)
|
162
|
-
web-console (4.0.
|
163
|
+
web-console (4.0.4)
|
163
164
|
actionview (>= 6.0.0)
|
164
165
|
activemodel (>= 6.0.0)
|
165
166
|
bindex (>= 0.4.0)
|
166
167
|
railties (>= 6.0.0)
|
167
|
-
websocket-driver (0.7.
|
168
|
+
websocket-driver (0.7.3)
|
168
169
|
websocket-extensions (>= 0.1.0)
|
169
|
-
websocket-extensions (0.1.
|
170
|
-
zeitwerk (2.3.
|
170
|
+
websocket-extensions (0.1.5)
|
171
|
+
zeitwerk (2.3.1)
|
171
172
|
|
172
173
|
PLATFORMS
|
173
174
|
ruby
|
@@ -175,8 +176,8 @@ PLATFORMS
|
|
175
176
|
DEPENDENCIES
|
176
177
|
byebug
|
177
178
|
jbuilder (~> 2.7)
|
178
|
-
puma (~>
|
179
|
-
rails (~> 6.0.
|
179
|
+
puma (~> 4.1)
|
180
|
+
rails (~> 6.0.3)
|
180
181
|
sorbet
|
181
182
|
sorbet-rails!
|
182
183
|
sorbet-runtime
|
@@ -2,7 +2,7 @@
|
|
2
2
|
class Wizard < ApplicationRecord
|
3
3
|
validates :name, length: { minimum: 5 }, presence: true
|
4
4
|
# simulate conditional validation
|
5
|
-
validates :parent_email, presence: true, if:
|
5
|
+
validates :parent_email, presence: true, if: :Slytherin?
|
6
6
|
|
7
7
|
typed_enum house: {
|
8
8
|
Gryffindor: 0,
|
@@ -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
|
|
@@ -29,26 +29,6 @@ T.assert_type!(T.must(wizard.wand).wizard, Wizard)
|
|
29
29
|
T.assert_type!(wizard.spell_books, SpellBook::ActiveRecord_Associations_CollectionProxy)
|
30
30
|
T.assert_type!(wizard.spell_book_ids, T::Array[Integer])
|
31
31
|
|
32
|
-
# -- model relation
|
33
|
-
# default
|
34
|
-
T.assert_type!(Wizard.all, Wizard::ActiveRecord_Relation)
|
35
|
-
|
36
|
-
# custom scope
|
37
|
-
T.assert_type!(Wizard.recent, Wizard::ActiveRecord_Relation)
|
38
|
-
|
39
|
-
# enum scope
|
40
|
-
T.assert_type!(Wizard.Gryffindor, Wizard::ActiveRecord_Relation)
|
41
|
-
|
42
|
-
# ActiveRecord Querying
|
43
|
-
T.assert_type!(Wizard.Gryffindor.recent, Wizard::ActiveRecord_Relation)
|
44
|
-
T.assert_type!(Wizard.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
|
45
|
-
T.assert_type!(Wizard.where(id: 1), Wizard::ActiveRecord_Relation)
|
46
|
-
T.assert_type!(Wizard.where(id: 1).recent, Wizard::ActiveRecord_Relation)
|
47
|
-
T.assert_type!(Wizard.where.not(id: 1), Wizard::ActiveRecord_Relation)
|
48
|
-
T.assert_type!(Wizard.preload(:spell_books), Wizard::ActiveRecord_Relation)
|
49
|
-
T.assert_type!(Wizard.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
|
50
|
-
T.assert_type!(Wizard.order(:id), Wizard::ActiveRecord_Relation)
|
51
|
-
|
52
32
|
# Finder methods -- Model
|
53
33
|
T.assert_type!(Wizard.exists?(name: 'Test'), T::Boolean)
|
54
34
|
T.assert_type!(Wizard.find(wizard.id), Wizard)
|
@@ -83,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
|
|
83
63
|
T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
|
84
64
|
Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
|
85
65
|
T.assert_type!(Wizard.find_in_batches, T::Enumerator[T::Array[Wizard]])
|
66
|
+
Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
|
67
|
+
T.assert_type!(Wizard.in_batches, ActiveRecord::Batches::BatchEnumerator)
|
86
68
|
# T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
|
87
69
|
T.assert_type!(Wizard.any?, T::Boolean)
|
88
70
|
T.assert_type!(Wizard.many?, T::Boolean)
|
@@ -90,6 +72,18 @@ T.assert_type!(Wizard.none?, T::Boolean)
|
|
90
72
|
T.assert_type!(Wizard.one?, T::Boolean)
|
91
73
|
# T.assert_type!(Wizard.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
|
92
74
|
# T.assert_type!(Wizard.delete_all, Integer) # Ignored until we add support
|
75
|
+
# Query methods
|
76
|
+
T.assert_type!(Wizard.all, Wizard::ActiveRecord_Relation)
|
77
|
+
T.assert_type!(Wizard.recent, Wizard::ActiveRecord_Relation) # Named scope
|
78
|
+
T.assert_type!(Wizard.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
|
79
|
+
T.assert_type!(Wizard.Gryffindor.recent, Wizard::ActiveRecord_Relation)
|
80
|
+
T.assert_type!(Wizard.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
|
81
|
+
T.assert_type!(Wizard.where(id: 1), Wizard::ActiveRecord_Relation)
|
82
|
+
T.assert_type!(Wizard.where(id: 1).recent, Wizard::ActiveRecord_Relation)
|
83
|
+
T.assert_type!(Wizard.where.not(id: 1), Wizard::ActiveRecord_Relation)
|
84
|
+
T.assert_type!(Wizard.preload(:spell_books), Wizard::ActiveRecord_Relation)
|
85
|
+
T.assert_type!(Wizard.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
|
86
|
+
T.assert_type!(Wizard.order(:id), Wizard::ActiveRecord_Relation)
|
93
87
|
|
94
88
|
# Finder methods -- ActiveRecord::Relation
|
95
89
|
T.assert_type!(Wizard.all.exists?(name: 'Harry Potter'), T::Boolean)
|
@@ -126,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
|
|
126
120
|
T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
|
127
121
|
Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
|
128
122
|
T.assert_type!(Wizard.all.find_in_batches, T::Enumerator[T::Array[Wizard]])
|
123
|
+
Wizard.all.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
|
124
|
+
T.assert_type!(Wizard.all.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
|
129
125
|
# T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
|
130
126
|
T.assert_type!(Wizard.all.any?, T::Boolean)
|
131
127
|
T.assert_type!(Wizard.all.many?, T::Boolean)
|
@@ -133,6 +129,18 @@ T.assert_type!(Wizard.all.none?, T::Boolean)
|
|
133
129
|
T.assert_type!(Wizard.all.one?, T::Boolean)
|
134
130
|
# T.assert_type!(Wizard.all.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
|
135
131
|
# T.assert_type!(Wizard.all.delete_all, Integer) # Ignored until we add support
|
132
|
+
# Query methods
|
133
|
+
T.assert_type!(Wizard.all.all, Wizard::ActiveRecord_Relation)
|
134
|
+
T.assert_type!(Wizard.all.recent, Wizard::ActiveRecord_Relation) # Named scope
|
135
|
+
T.assert_type!(Wizard.all.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
|
136
|
+
T.assert_type!(Wizard.all.Gryffindor.recent, Wizard::ActiveRecord_Relation)
|
137
|
+
T.assert_type!(Wizard.all.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
|
138
|
+
T.assert_type!(Wizard.all.where(id: 1), Wizard::ActiveRecord_Relation)
|
139
|
+
T.assert_type!(Wizard.all.where(id: 1).recent, Wizard::ActiveRecord_Relation)
|
140
|
+
T.assert_type!(Wizard.all.where.not(id: 1), Wizard::ActiveRecord_Relation)
|
141
|
+
T.assert_type!(Wizard.all.preload(:spell_books), Wizard::ActiveRecord_Relation)
|
142
|
+
T.assert_type!(Wizard.all.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
|
143
|
+
T.assert_type!(Wizard.all.order(:id), Wizard::ActiveRecord_Relation)
|
136
144
|
# Enumerable methods
|
137
145
|
Wizard.all.each { |w| T.assert_type!(w, Wizard) }
|
138
146
|
Wizard.all.map { |w| T.assert_type!(w, Wizard) }
|
@@ -172,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
|
|
172
180
|
T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
|
173
181
|
T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
|
174
182
|
T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
183
|
+
spell_books.find_each { |s| T.assert_type!(s, SpellBook) }
|
184
|
+
T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook])
|
185
|
+
spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) }
|
186
|
+
T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]])
|
187
|
+
spell_books.in_batches { |s| T.assert_type!(s, SpellBook::ActiveRecord_AssociationRelation) }
|
188
|
+
T.assert_type!(spell_books.in_batches, T::Enumerable[SpellBook::ActiveRecord_AssociationRelation])
|
179
189
|
# T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
|
180
190
|
T.assert_type!(spell_books.any?, T::Boolean)
|
181
191
|
T.assert_type!(spell_books.many?, T::Boolean)
|
@@ -183,13 +193,18 @@ T.assert_type!(spell_books.none?, T::Boolean)
|
|
183
193
|
T.assert_type!(spell_books.one?, T::Boolean)
|
184
194
|
# T.assert_type!(spell_books.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
|
185
195
|
# T.assert_type!(spell_books.delete_all, Integer) # Ignored until we add support
|
186
|
-
#
|
196
|
+
# Query methods
|
197
|
+
T.assert_type!(spell_books.all, SpellBook::ActiveRecord_AssociationRelation)
|
198
|
+
T.assert_type!(spell_books.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
|
199
|
+
T.assert_type!(spell_books.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
|
200
|
+
T.assert_type!(spell_books.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
|
201
|
+
T.assert_type!(spell_books.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
|
187
202
|
T.assert_type!(spell_books.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
203
|
+
T.assert_type!(spell_books.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
|
204
|
+
T.assert_type!(spell_books.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
188
205
|
T.assert_type!(spell_books.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
|
189
206
|
T.assert_type!(spell_books.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
|
190
207
|
T.assert_type!(spell_books.order(:id), SpellBook::ActiveRecord_AssociationRelation)
|
191
|
-
T.assert_type!(spell_books.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
192
|
-
T.assert_type!(spell_books.biology, SpellBook::ActiveRecord_AssociationRelation)
|
193
208
|
# Enumerable methods
|
194
209
|
spell_books.each { |s| T.assert_type!(s, SpellBook) }
|
195
210
|
spell_books.map { |s| T.assert_type!(s, SpellBook) }
|
@@ -237,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
|
|
237
252
|
T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
|
238
253
|
T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
|
239
254
|
T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
255
|
+
spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) }
|
256
|
+
T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook])
|
257
|
+
spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) }
|
258
|
+
T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]])
|
259
|
+
spell_books_query.in_batches { |s| T.assert_type!(s, SpellBook::ActiveRecord_AssociationRelation) }
|
260
|
+
T.assert_type!(spell_books_query.in_batches, T::Enumerable[SpellBook::ActiveRecord_AssociationRelation])
|
244
261
|
# T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
|
245
262
|
T.assert_type!(spell_books_query.any?, T::Boolean)
|
246
263
|
T.assert_type!(spell_books_query.many?, T::Boolean)
|
@@ -248,12 +265,18 @@ T.assert_type!(spell_books_query.none?, T::Boolean)
|
|
248
265
|
T.assert_type!(spell_books_query.one?, T::Boolean)
|
249
266
|
# T.assert_type!(spell_books_query.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
|
250
267
|
# T.assert_type!(spell_books_query.delete_all, Integer) # Ignored until we add support
|
251
|
-
# Query
|
268
|
+
# Query methods
|
269
|
+
T.assert_type!(spell_books_query.all, SpellBook::ActiveRecord_AssociationRelation)
|
270
|
+
T.assert_type!(spell_books_query.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
|
271
|
+
T.assert_type!(spell_books_query.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
|
272
|
+
T.assert_type!(spell_books_query.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
|
273
|
+
T.assert_type!(spell_books_query.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
|
274
|
+
T.assert_type!(spell_books_query.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
275
|
+
T.assert_type!(spell_books_query.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
|
276
|
+
T.assert_type!(spell_books_query.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
252
277
|
T.assert_type!(spell_books_query.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
|
253
278
|
T.assert_type!(spell_books_query.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
|
254
279
|
T.assert_type!(spell_books_query.order(:id), SpellBook::ActiveRecord_AssociationRelation)
|
255
|
-
T.assert_type!(spell_books_query.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
|
256
|
-
T.assert_type!(spell_books_query.biology, SpellBook::ActiveRecord_AssociationRelation)
|
257
280
|
# Enumerable methods
|
258
281
|
spell_books_query.each { |s| T.assert_type!(s, SpellBook) }
|
259
282
|
spell_books_query.map { |s| T.assert_type!(s, SpellBook) }
|
@@ -338,44 +361,6 @@ params = ActionController::Parameters.new({
|
|
338
361
|
typed_params = TypedParams[MyActionParams].new.extract!(params)
|
339
362
|
T.assert_type!(typed_params, MyActionParams)
|
340
363
|
|
341
|
-
# -- require_typed
|
342
|
-
T.assert_type!(
|
343
|
-
params.require_typed(:age, TA[Integer].new),
|
344
|
-
Integer,
|
345
|
-
)
|
346
|
-
T.assert_type!(
|
347
|
-
params.require_typed(:name, TA[String].new),
|
348
|
-
String,
|
349
|
-
)
|
350
|
-
info = params.require_typed(:info, TA[ActionController::Parameters].new)
|
351
|
-
T.assert_type!(info, ActionController::Parameters)
|
352
|
-
T.assert_type!(
|
353
|
-
info.require_typed(:friends, TA[T::Array[String]].new),
|
354
|
-
T::Array[String],
|
355
|
-
)
|
356
|
-
# -- fetch_typed
|
357
|
-
T.assert_type!(
|
358
|
-
params.fetch_typed(:age, TA[Integer].new),
|
359
|
-
Integer,
|
360
|
-
)
|
361
|
-
T.assert_type!(
|
362
|
-
params.fetch_typed(:name, TA[String].new),
|
363
|
-
String,
|
364
|
-
)
|
365
|
-
T.assert_type!(
|
366
|
-
params.fetch_typed(:nonexistence, TA[String].new, ''),
|
367
|
-
String,
|
368
|
-
)
|
369
|
-
T.assert_type!(
|
370
|
-
params.fetch_typed(:nonexistence, TA[T.nilable(String)].new, nil),
|
371
|
-
T.nilable(String),
|
372
|
-
)
|
373
|
-
T.assert_type!(
|
374
|
-
params.fetch_typed(:nonexistence, TA[T::Array[Integer]].new, []),
|
375
|
-
T::Array[Integer],
|
376
|
-
)
|
377
|
-
|
378
|
-
|
379
364
|
# -- pluck to tstruct
|
380
365
|
class WizardStruct < T::Struct
|
381
366
|
const :name, String
|
@@ -392,23 +377,16 @@ Wizard.all.pluck_to_tstruct(TA[WizardStruct].new).each do |row|
|
|
392
377
|
T.assert_type!(row, WizardStruct)
|
393
378
|
end
|
394
379
|
|
395
|
-
|
396
380
|
# -- GeneratedUrlHelpers
|
397
381
|
class TestHelper
|
398
382
|
include GeneratedUrlHelpers
|
399
|
-
|
400
|
-
# need to implement this for the url
|
401
|
-
def default_url_options
|
402
|
-
{
|
403
|
-
protocol: 'http',
|
404
|
-
host: 'localhost',
|
405
|
-
port: 3000,
|
406
|
-
}
|
407
|
-
end
|
408
|
-
|
409
|
-
def test_url_helper
|
410
|
-
T.assert_type!(test_index_path, String)
|
411
|
-
T.assert_type!(test_index_url, String)
|
412
|
-
end
|
413
383
|
end
|
414
|
-
|
384
|
+
|
385
|
+
T.assert_type!(TestHelper.new.test_index_path, String)
|
386
|
+
# need to set this config for _url methods
|
387
|
+
Rails.application.routes.default_url_options = {
|
388
|
+
protocol: 'http',
|
389
|
+
host: 'localhost',
|
390
|
+
port: 3000,
|
391
|
+
}
|
392
|
+
T.assert_type!(TestHelper.new.test_index_url, String)
|