sorbet-rails 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +2 -2
- data/README.md +22 -1
- data/lib/sorbet-rails/actionmailer.rbi +7 -0
- data/lib/sorbet-rails/activerecord.rbi +3 -0
- data/lib/sorbet-rails/config.rb +5 -0
- data/lib/sorbet-rails/helper_rbi_formatter.rb +3 -0
- data/lib/sorbet-rails/mailer_rbi_formatter.rb +38 -0
- data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +26 -6
- data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +4 -5
- data/lib/sorbet-rails/model_plugins/active_record_enum.rb +37 -3
- data/lib/sorbet-rails/model_plugins/active_record_named_scope.rb +2 -0
- data/lib/sorbet-rails/model_plugins/active_record_overrides.rb +27 -0
- data/lib/sorbet-rails/model_plugins/active_storage_methods.rb +60 -0
- data/lib/sorbet-rails/model_plugins/plugins.rb +4 -0
- data/lib/sorbet-rails/sorbet_utils.rb +68 -0
- data/lib/sorbet-rails/tasks/rails_rbi.rake +20 -0
- data/lib/sorbet-rails/utils.rb +5 -0
- data/sorbet-rails.gemspec +1 -1
- data/spec/generators/rails-template.rb +145 -16
- data/spec/generators/sorbet_test_cases.rb +11 -0
- data/spec/helper_rbi_formatter_spec.rb +19 -0
- data/spec/mailer_rbi_formatter_spec.rb +13 -0
- data/spec/model_rbi_formatter_spec.rb +12 -2
- data/spec/rails_helper.rb +20 -0
- data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
- data/spec/rake_rails_rbi_models_spec.rb +1 -21
- data/spec/sorbet_spec.rb +13 -0
- data/spec/sorbet_utils_spec.rb +126 -0
- data/spec/support/v4.2/Gemfile.lock +5 -5
- data/spec/support/v4.2/app/mailers/application_mailer.rb +3 -0
- data/spec/support/v4.2/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v4.2/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
- data/spec/support/v4.2/app/models/wizard.rb +14 -0
- data/spec/support/v4.2/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v4.2/db/schema.rb +2 -1
- data/spec/support/v4.2/sorbet_test_cases.rb +11 -0
- data/spec/support/v5.0/Gemfile.lock +6 -6
- data/spec/support/v5.0/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v5.0/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
- data/spec/support/v5.0/app/models/wizard.rb +33 -0
- data/spec/support/v5.0/config/initializers/new_framework_defaults.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000001_create_wizards.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000002_create_wands.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000003_create_spell_books.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +1 -1
- data/spec/support/v5.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v5.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v5.0/db/schema.rb +9 -4
- data/spec/support/v5.0/sorbet_test_cases.rb +11 -0
- data/spec/support/v5.1/Gemfile.lock +6 -6
- data/spec/support/v5.1/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v5.1/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
- data/spec/support/v5.1/app/models/wizard.rb +33 -0
- data/spec/support/v5.1/db/migrate/20190620000001_create_wizards.rb +1 -1
- data/spec/support/v5.1/db/migrate/20190620000002_create_wands.rb +1 -1
- data/spec/support/v5.1/db/migrate/20190620000003_create_spell_books.rb +1 -1
- data/spec/support/v5.1/db/migrate/20190620000004_add_more_column_types_to_wands.rb +1 -1
- data/spec/support/v5.1/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v5.1/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v5.1/db/schema.rb +7 -2
- data/spec/support/v5.1/sorbet_test_cases.rb +11 -0
- data/spec/support/v5.2/Gemfile.lock +6 -6
- data/spec/support/v5.2/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v5.2/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
- data/spec/support/v5.2/app/models/wizard.rb +34 -0
- data/spec/support/v5.2/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v5.2/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v5.2/db/schema.rb +7 -2
- data/spec/support/v5.2/sorbet_test_cases.rb +11 -0
- data/spec/support/v6.0/Gemfile.lock +6 -6
- data/spec/support/v6.0/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v6.0/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
- data/spec/support/v6.0/app/models/wizard.rb +35 -1
- data/spec/support/v6.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v6.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v6.0/db/schema.rb +6 -1
- data/spec/support/v6.0/sorbet_test_cases.rb +11 -0
- data/spec/test_data/v4.2/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v4.2/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v4.2/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v4.2/expected_hogwarts_acceptance_mailer.rbi +10 -0
- data/spec/test_data/v4.2/expected_srb_tc_output.txt +57 -1
- data/spec/test_data/v4.2/expected_wizard.rbi +69 -0
- data/spec/test_data/v4.2/expected_wizard_wo_spellbook.rbi +69 -0
- data/spec/test_data/v5.0/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v5.0/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v5.0/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v5.0/expected_hogwarts_acceptance_mailer.rbi +10 -0
- data/spec/test_data/v5.0/expected_spell_book.rbi +2 -2
- data/spec/test_data/v5.0/expected_wizard.rbi +294 -0
- data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +294 -0
- data/spec/test_data/v5.1/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v5.1/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v5.1/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v5.1/expected_hogwarts_acceptance_mailer.rbi +10 -0
- data/spec/test_data/v5.1/expected_spell_book.rbi +2 -2
- data/spec/test_data/v5.1/expected_wizard.rbi +294 -0
- data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +294 -0
- data/spec/test_data/v5.2-no-sorbet/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v5.2/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v5.2/expected_attachment.rbi +4 -4
- data/spec/test_data/v5.2/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v5.2/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v5.2/expected_hogwarts_acceptance_mailer.rbi +10 -0
- data/spec/test_data/v5.2/expected_spell_book.rbi +2 -2
- data/spec/test_data/v5.2/expected_wizard.rbi +342 -0
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +342 -0
- data/spec/test_data/v6.0/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v6.0/expected_attachment.rbi +4 -4
- data/spec/test_data/v6.0/expected_blob.rbi +28 -22
- data/spec/test_data/v6.0/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v6.0/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
- data/spec/test_data/v6.0/expected_hogwarts_acceptance_mailer.rbi +10 -0
- data/spec/test_data/v6.0/expected_spell_book.rbi +2 -2
- data/spec/test_data/v6.0/expected_wizard.rbi +526 -16
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +526 -16
- metadata +94 -1
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: false
|
2
|
+
class AddMoreEnumsToWizard < ActiveRecord::Migration[5.1]
|
3
|
+
def change
|
4
|
+
add_column :wizards, :quidditch_position, :integer
|
5
|
+
add_column :wizards, :hair_color, :integer
|
6
|
+
add_column :wizards, :eye_color, :integer
|
7
|
+
add_column :wizards, :hair_length, :integer
|
8
|
+
end
|
9
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: false
|
2
2
|
# This file is auto-generated from the current state of the database. Instead
|
3
3
|
# of editing this file, please use the migrations feature of Active Record to
|
4
4
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -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: 20190620000006) do
|
15
15
|
|
16
16
|
create_table "spell_books", force: :cascade do |t|
|
17
17
|
t.string "name"
|
@@ -42,6 +42,11 @@ ActiveRecord::Schema.define(version: 20190620000004) do
|
|
42
42
|
t.text "notes"
|
43
43
|
t.datetime "created_at", null: false
|
44
44
|
t.datetime "updated_at", null: false
|
45
|
+
t.string "broom"
|
46
|
+
t.integer "quidditch_position"
|
47
|
+
t.integer "hair_color"
|
48
|
+
t.integer "eye_color"
|
49
|
+
t.integer "hair_length"
|
45
50
|
end
|
46
51
|
|
47
52
|
end
|
@@ -153,9 +153,20 @@ T.assert_type!(wizard.notes, T.nilable(String))
|
|
153
153
|
T.assert_type!(wizard.Gryffindor?, T::Boolean)
|
154
154
|
T.assert_type!(wizard.house, T.nilable(String))
|
155
155
|
T.assert_type!(Wizard.houses, T::Hash[T.any(String, Symbol), Integer])
|
156
|
+
T.assert_type!(Wizard.brooms, T::Hash[T.any(String, Symbol), String])
|
156
157
|
T.assert_type!(spell_book.biology?, T::Boolean)
|
157
158
|
T.assert_type!(spell_book.book_type, String)
|
158
159
|
T.assert_type!(SpellBook.book_types, T::Hash[T.any(String, Symbol), Integer])
|
159
160
|
|
160
161
|
# Mythical plugin
|
161
162
|
T.assert_type!(Wand.mythicals, T::Array[Wand])
|
163
|
+
|
164
|
+
T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
|
165
|
+
|
166
|
+
if ENV["RAILS_VERSION"] != "4.2"
|
167
|
+
T.assert_type!(wizard.broom_nimbus?, T::Boolean)
|
168
|
+
T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
|
169
|
+
T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
|
170
|
+
T.assert_type!(wizard.brown_hair?, T::Boolean)
|
171
|
+
end
|
172
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../..
|
3
3
|
specs:
|
4
|
-
sorbet-rails (0.5.
|
4
|
+
sorbet-rails (0.5.3)
|
5
5
|
parlour (~> 0.6.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -73,7 +73,7 @@ GEM
|
|
73
73
|
mini_mime (1.0.2)
|
74
74
|
mini_portile2 (2.4.0)
|
75
75
|
minitest (5.11.3)
|
76
|
-
nio4r (2.
|
76
|
+
nio4r (2.5.1)
|
77
77
|
nokogiri (1.10.4)
|
78
78
|
mini_portile2 (~> 2.4.0)
|
79
79
|
parlour (0.6.1)
|
@@ -109,10 +109,10 @@ GEM
|
|
109
109
|
thor (>= 0.19.0, < 2.0)
|
110
110
|
rainbow (3.0.0)
|
111
111
|
rake (12.3.3)
|
112
|
-
sorbet (0.4.
|
113
|
-
sorbet-static (= 0.4.
|
114
|
-
sorbet-runtime (0.4.
|
115
|
-
sorbet-static (0.4.
|
112
|
+
sorbet (0.4.4709)
|
113
|
+
sorbet-static (= 0.4.4709)
|
114
|
+
sorbet-runtime (0.4.4709)
|
115
|
+
sorbet-static (0.4.4709-universal-darwin-14)
|
116
116
|
sprockets (3.7.2)
|
117
117
|
concurrent-ruby (~> 1.0)
|
118
118
|
rack (> 1, < 3)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# typed: true
|
2
|
+
class HogwartsAcceptanceMailer < ApplicationMailer
|
3
|
+
extend T::Sig
|
4
|
+
|
5
|
+
sig { params(student: Wizard).void }
|
6
|
+
def notify(student)
|
7
|
+
# TODO: mail acceptance letter to student
|
8
|
+
end
|
9
|
+
|
10
|
+
def notify_retry(student)
|
11
|
+
# TODO: send more owls!!
|
12
|
+
end
|
13
|
+
end
|
@@ -9,8 +9,42 @@ class Wizard < ApplicationRecord
|
|
9
9
|
Slytherin: 3,
|
10
10
|
}
|
11
11
|
|
12
|
+
enum professor: {
|
13
|
+
"Severus Snape": 0,
|
14
|
+
"Minerva McGonagall": 1,
|
15
|
+
"Pomona Sprout": 2,
|
16
|
+
"Filius Flitwick": 3,
|
17
|
+
"Hagrid": 4,
|
18
|
+
}
|
19
|
+
|
20
|
+
enum broom: {
|
21
|
+
nimbus: 'nimbus',
|
22
|
+
firebolt: 'firebolt',
|
23
|
+
}, _prefix: true
|
24
|
+
|
25
|
+
enum quidditch_position: {
|
26
|
+
keeper: 0,
|
27
|
+
seeker: 1,
|
28
|
+
beater: 2,
|
29
|
+
chaser: 3,
|
30
|
+
}, _prefix: :quidditch
|
31
|
+
|
32
|
+
enum hair_color: {
|
33
|
+
brown: 0,
|
34
|
+
black: 1,
|
35
|
+
blonde: 2,
|
36
|
+
}, _suffix: :hair
|
37
|
+
|
38
|
+
enum eye_color: {
|
39
|
+
brown: 0,
|
40
|
+
green: 1,
|
41
|
+
blue: 2,
|
42
|
+
}, _prefix: :color, _suffix: :eyes
|
43
|
+
|
12
44
|
has_one :wand
|
13
45
|
has_many :spell_books
|
14
46
|
|
15
47
|
scope :recent, -> { where('created_at > ?', 1.month.ago) }
|
48
|
+
has_one_attached :school_photo
|
49
|
+
has_many_attached :hats
|
16
50
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: true
|
2
|
+
class AddMoreEnumsToWizard < ActiveRecord::Migration[5.2]
|
3
|
+
def change
|
4
|
+
add_column :wizards, :quidditch_position, :integer
|
5
|
+
add_column :wizards, :hair_color, :integer
|
6
|
+
add_column :wizards, :eye_color, :integer
|
7
|
+
add_column :wizards, :hair_length, :integer
|
8
|
+
end
|
9
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strong
|
2
2
|
# This file is auto-generated from the current state of the database. Instead
|
3
3
|
# of editing this file, please use the migrations feature of Active Record to
|
4
4
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -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_000006) do
|
15
15
|
|
16
16
|
create_table "spell_books", force: :cascade do |t|
|
17
17
|
t.string "name"
|
@@ -44,6 +44,11 @@ ActiveRecord::Schema.define(version: 2019_06_20_000004) do
|
|
44
44
|
t.text "notes"
|
45
45
|
t.datetime "created_at", null: false
|
46
46
|
t.datetime "updated_at", null: false
|
47
|
+
t.string "broom"
|
48
|
+
t.integer "quidditch_position"
|
49
|
+
t.integer "hair_color"
|
50
|
+
t.integer "eye_color"
|
51
|
+
t.integer "hair_length"
|
47
52
|
end
|
48
53
|
|
49
54
|
end
|
@@ -153,9 +153,20 @@ T.assert_type!(wizard.notes, T.nilable(String))
|
|
153
153
|
T.assert_type!(wizard.Gryffindor?, T::Boolean)
|
154
154
|
T.assert_type!(wizard.house, T.nilable(String))
|
155
155
|
T.assert_type!(Wizard.houses, T::Hash[T.any(String, Symbol), Integer])
|
156
|
+
T.assert_type!(Wizard.brooms, T::Hash[T.any(String, Symbol), String])
|
156
157
|
T.assert_type!(spell_book.biology?, T::Boolean)
|
157
158
|
T.assert_type!(spell_book.book_type, String)
|
158
159
|
T.assert_type!(SpellBook.book_types, T::Hash[T.any(String, Symbol), Integer])
|
159
160
|
|
160
161
|
# Mythical plugin
|
161
162
|
T.assert_type!(Wand.mythicals, T::Array[Wand])
|
163
|
+
|
164
|
+
T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
|
165
|
+
|
166
|
+
if ENV["RAILS_VERSION"] != "4.2"
|
167
|
+
T.assert_type!(wizard.broom_nimbus?, T::Boolean)
|
168
|
+
T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
|
169
|
+
T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
|
170
|
+
T.assert_type!(wizard.brown_hair?, T::Boolean)
|
171
|
+
end
|
172
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../../..
|
3
3
|
specs:
|
4
|
-
sorbet-rails (0.5.
|
4
|
+
sorbet-rails (0.5.3)
|
5
5
|
parlour (~> 0.6.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -86,7 +86,7 @@ GEM
|
|
86
86
|
mini_mime (1.0.2)
|
87
87
|
mini_portile2 (2.4.0)
|
88
88
|
minitest (5.11.3)
|
89
|
-
nio4r (2.
|
89
|
+
nio4r (2.5.1)
|
90
90
|
nokogiri (1.10.4)
|
91
91
|
mini_portile2 (~> 2.4.0)
|
92
92
|
parlour (0.6.1)
|
@@ -124,10 +124,10 @@ GEM
|
|
124
124
|
thor (>= 0.20.3, < 2.0)
|
125
125
|
rainbow (3.0.0)
|
126
126
|
rake (12.3.3)
|
127
|
-
sorbet (0.4.
|
128
|
-
sorbet-static (= 0.4.
|
129
|
-
sorbet-runtime (0.4.
|
130
|
-
sorbet-static (0.4.
|
127
|
+
sorbet (0.4.4709)
|
128
|
+
sorbet-static (= 0.4.4709)
|
129
|
+
sorbet-runtime (0.4.4709)
|
130
|
+
sorbet-static (0.4.4709-universal-darwin-14)
|
131
131
|
sprockets (3.7.2)
|
132
132
|
concurrent-ruby (~> 1.0)
|
133
133
|
rack (> 1, < 3)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# typed: true
|
2
|
+
class HogwartsAcceptanceMailer < ApplicationMailer
|
3
|
+
extend T::Sig
|
4
|
+
|
5
|
+
sig { params(student: Wizard).void }
|
6
|
+
def notify(student)
|
7
|
+
# TODO: mail acceptance letter to student
|
8
|
+
end
|
9
|
+
|
10
|
+
def notify_retry(student)
|
11
|
+
# TODO: send more owls!!
|
12
|
+
end
|
13
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: false
|
2
2
|
class Wizard < ApplicationRecord
|
3
3
|
validates :name, length: { minimum: 5 }, presence: true
|
4
4
|
|
@@ -9,8 +9,42 @@ class Wizard < ApplicationRecord
|
|
9
9
|
Slytherin: 3,
|
10
10
|
}
|
11
11
|
|
12
|
+
enum professor: {
|
13
|
+
"Severus Snape": 0,
|
14
|
+
"Minerva McGonagall": 1,
|
15
|
+
"Pomona Sprout": 2,
|
16
|
+
"Filius Flitwick": 3,
|
17
|
+
"Hagrid": 4,
|
18
|
+
}
|
19
|
+
|
20
|
+
enum broom: {
|
21
|
+
nimbus: 'nimbus',
|
22
|
+
firebolt: 'firebolt',
|
23
|
+
}, _prefix: true
|
24
|
+
|
25
|
+
enum quidditch_position: {
|
26
|
+
keeper: 0,
|
27
|
+
seeker: 1,
|
28
|
+
beater: 2,
|
29
|
+
chaser: 3,
|
30
|
+
}, _prefix: :quidditch
|
31
|
+
|
32
|
+
enum hair_color: {
|
33
|
+
brown: 0,
|
34
|
+
black: 1,
|
35
|
+
blonde: 2,
|
36
|
+
}, _suffix: :hair
|
37
|
+
|
38
|
+
enum eye_color: {
|
39
|
+
brown: 0,
|
40
|
+
green: 1,
|
41
|
+
blue: 2,
|
42
|
+
}, _prefix: :color, _suffix: :eyes
|
43
|
+
|
12
44
|
has_one :wand
|
13
45
|
has_many :spell_books
|
14
46
|
|
15
47
|
scope :recent, -> { where('created_at > ?', 1.month.ago) }
|
48
|
+
has_one_attached :school_photo
|
49
|
+
has_many_attached :hats
|
16
50
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: true
|
2
|
+
class AddMoreEnumsToWizard < ActiveRecord::Migration[6.0]
|
3
|
+
def change
|
4
|
+
add_column :wizards, :quidditch_position, :integer
|
5
|
+
add_column :wizards, :hair_color, :integer
|
6
|
+
add_column :wizards, :eye_color, :integer
|
7
|
+
add_column :wizards, :hair_length, :integer
|
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_000006) do
|
15
15
|
|
16
16
|
create_table "spell_books", force: :cascade do |t|
|
17
17
|
t.string "name"
|
@@ -44,6 +44,11 @@ ActiveRecord::Schema.define(version: 2019_06_20_000004) do
|
|
44
44
|
t.text "notes"
|
45
45
|
t.datetime "created_at", precision: 6, null: false
|
46
46
|
t.datetime "updated_at", precision: 6, null: false
|
47
|
+
t.string "broom"
|
48
|
+
t.integer "quidditch_position"
|
49
|
+
t.integer "hair_color"
|
50
|
+
t.integer "eye_color"
|
51
|
+
t.integer "hair_length"
|
47
52
|
end
|
48
53
|
|
49
54
|
end
|
@@ -153,9 +153,20 @@ T.assert_type!(wizard.notes, T.nilable(String))
|
|
153
153
|
T.assert_type!(wizard.Gryffindor?, T::Boolean)
|
154
154
|
T.assert_type!(wizard.house, T.nilable(String))
|
155
155
|
T.assert_type!(Wizard.houses, T::Hash[T.any(String, Symbol), Integer])
|
156
|
+
T.assert_type!(Wizard.brooms, T::Hash[T.any(String, Symbol), String])
|
156
157
|
T.assert_type!(spell_book.biology?, T::Boolean)
|
157
158
|
T.assert_type!(spell_book.book_type, String)
|
158
159
|
T.assert_type!(SpellBook.book_types, T::Hash[T.any(String, Symbol), Integer])
|
159
160
|
|
160
161
|
# Mythical plugin
|
161
162
|
T.assert_type!(Wand.mythicals, T::Array[Wand])
|
163
|
+
|
164
|
+
T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
|
165
|
+
|
166
|
+
if ENV["RAILS_VERSION"] != "4.2"
|
167
|
+
T.assert_type!(wizard.broom_nimbus?, T::Boolean)
|
168
|
+
T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
|
169
|
+
T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
|
170
|
+
T.assert_type!(wizard.brown_hair?, T::Boolean)
|
171
|
+
end
|
172
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# This is an autogenerated file for Rails helpers.
|
3
|
+
# Please rerun rake rails_rbi:mailers to regenerate.
|
4
|
+
class DailyProphetMailer
|
5
|
+
sig { params(wizards: T::Array[Wizard], hotnews_only: T::Boolean).returns(ActionMailer::MessageDelivery) }
|
6
|
+
def self.notify_subscribers(wizards, hotnews_only); end
|
7
|
+
end
|