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.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CONTRIBUTING.md +2 -2
  4. data/README.md +22 -1
  5. data/lib/sorbet-rails/actionmailer.rbi +7 -0
  6. data/lib/sorbet-rails/activerecord.rbi +3 -0
  7. data/lib/sorbet-rails/config.rb +5 -0
  8. data/lib/sorbet-rails/helper_rbi_formatter.rb +3 -0
  9. data/lib/sorbet-rails/mailer_rbi_formatter.rb +38 -0
  10. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +26 -6
  11. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +4 -5
  12. data/lib/sorbet-rails/model_plugins/active_record_enum.rb +37 -3
  13. data/lib/sorbet-rails/model_plugins/active_record_named_scope.rb +2 -0
  14. data/lib/sorbet-rails/model_plugins/active_record_overrides.rb +27 -0
  15. data/lib/sorbet-rails/model_plugins/active_storage_methods.rb +60 -0
  16. data/lib/sorbet-rails/model_plugins/plugins.rb +4 -0
  17. data/lib/sorbet-rails/sorbet_utils.rb +68 -0
  18. data/lib/sorbet-rails/tasks/rails_rbi.rake +20 -0
  19. data/lib/sorbet-rails/utils.rb +5 -0
  20. data/sorbet-rails.gemspec +1 -1
  21. data/spec/generators/rails-template.rb +145 -16
  22. data/spec/generators/sorbet_test_cases.rb +11 -0
  23. data/spec/helper_rbi_formatter_spec.rb +19 -0
  24. data/spec/mailer_rbi_formatter_spec.rb +13 -0
  25. data/spec/model_rbi_formatter_spec.rb +12 -2
  26. data/spec/rails_helper.rb +20 -0
  27. data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
  28. data/spec/rake_rails_rbi_models_spec.rb +1 -21
  29. data/spec/sorbet_spec.rb +13 -0
  30. data/spec/sorbet_utils_spec.rb +126 -0
  31. data/spec/support/v4.2/Gemfile.lock +5 -5
  32. data/spec/support/v4.2/app/mailers/application_mailer.rb +3 -0
  33. data/spec/support/v4.2/app/mailers/daily_prophet_mailer.rb +9 -0
  34. data/spec/support/v4.2/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
  35. data/spec/support/v4.2/app/models/wizard.rb +14 -0
  36. data/spec/support/v4.2/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  37. data/spec/support/v4.2/db/schema.rb +2 -1
  38. data/spec/support/v4.2/sorbet_test_cases.rb +11 -0
  39. data/spec/support/v5.0/Gemfile.lock +6 -6
  40. data/spec/support/v5.0/app/mailers/daily_prophet_mailer.rb +9 -0
  41. data/spec/support/v5.0/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
  42. data/spec/support/v5.0/app/models/wizard.rb +33 -0
  43. data/spec/support/v5.0/config/initializers/new_framework_defaults.rb +1 -1
  44. data/spec/support/v5.0/db/migrate/20190620000001_create_wizards.rb +1 -1
  45. data/spec/support/v5.0/db/migrate/20190620000002_create_wands.rb +1 -1
  46. data/spec/support/v5.0/db/migrate/20190620000003_create_spell_books.rb +1 -1
  47. data/spec/support/v5.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +1 -1
  48. data/spec/support/v5.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  49. data/spec/support/v5.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
  50. data/spec/support/v5.0/db/schema.rb +9 -4
  51. data/spec/support/v5.0/sorbet_test_cases.rb +11 -0
  52. data/spec/support/v5.1/Gemfile.lock +6 -6
  53. data/spec/support/v5.1/app/mailers/daily_prophet_mailer.rb +9 -0
  54. data/spec/support/v5.1/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
  55. data/spec/support/v5.1/app/models/wizard.rb +33 -0
  56. data/spec/support/v5.1/db/migrate/20190620000001_create_wizards.rb +1 -1
  57. data/spec/support/v5.1/db/migrate/20190620000002_create_wands.rb +1 -1
  58. data/spec/support/v5.1/db/migrate/20190620000003_create_spell_books.rb +1 -1
  59. data/spec/support/v5.1/db/migrate/20190620000004_add_more_column_types_to_wands.rb +1 -1
  60. data/spec/support/v5.1/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  61. data/spec/support/v5.1/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
  62. data/spec/support/v5.1/db/schema.rb +7 -2
  63. data/spec/support/v5.1/sorbet_test_cases.rb +11 -0
  64. data/spec/support/v5.2/Gemfile.lock +6 -6
  65. data/spec/support/v5.2/app/mailers/daily_prophet_mailer.rb +9 -0
  66. data/spec/support/v5.2/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
  67. data/spec/support/v5.2/app/models/wizard.rb +34 -0
  68. data/spec/support/v5.2/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  69. data/spec/support/v5.2/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
  70. data/spec/support/v5.2/db/schema.rb +7 -2
  71. data/spec/support/v5.2/sorbet_test_cases.rb +11 -0
  72. data/spec/support/v6.0/Gemfile.lock +6 -6
  73. data/spec/support/v6.0/app/mailers/daily_prophet_mailer.rb +9 -0
  74. data/spec/support/v6.0/app/mailers/hogwarts_acceptance_mailer.rb +13 -0
  75. data/spec/support/v6.0/app/models/wizard.rb +35 -1
  76. data/spec/support/v6.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  77. data/spec/support/v6.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
  78. data/spec/support/v6.0/db/schema.rb +6 -1
  79. data/spec/support/v6.0/sorbet_test_cases.rb +11 -0
  80. data/spec/test_data/v4.2/expected_application_mailer.rbi +5 -0
  81. data/spec/test_data/v4.2/expected_daily_prophet_mailer.rbi +7 -0
  82. data/spec/test_data/v4.2/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  83. data/spec/test_data/v4.2/expected_hogwarts_acceptance_mailer.rbi +10 -0
  84. data/spec/test_data/v4.2/expected_srb_tc_output.txt +57 -1
  85. data/spec/test_data/v4.2/expected_wizard.rbi +69 -0
  86. data/spec/test_data/v4.2/expected_wizard_wo_spellbook.rbi +69 -0
  87. data/spec/test_data/v5.0/expected_application_mailer.rbi +5 -0
  88. data/spec/test_data/v5.0/expected_daily_prophet_mailer.rbi +7 -0
  89. data/spec/test_data/v5.0/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  90. data/spec/test_data/v5.0/expected_hogwarts_acceptance_mailer.rbi +10 -0
  91. data/spec/test_data/v5.0/expected_spell_book.rbi +2 -2
  92. data/spec/test_data/v5.0/expected_wizard.rbi +294 -0
  93. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +294 -0
  94. data/spec/test_data/v5.1/expected_application_mailer.rbi +5 -0
  95. data/spec/test_data/v5.1/expected_daily_prophet_mailer.rbi +7 -0
  96. data/spec/test_data/v5.1/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  97. data/spec/test_data/v5.1/expected_hogwarts_acceptance_mailer.rbi +10 -0
  98. data/spec/test_data/v5.1/expected_spell_book.rbi +2 -2
  99. data/spec/test_data/v5.1/expected_wizard.rbi +294 -0
  100. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +294 -0
  101. data/spec/test_data/v5.2-no-sorbet/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  102. data/spec/test_data/v5.2/expected_application_mailer.rbi +5 -0
  103. data/spec/test_data/v5.2/expected_attachment.rbi +4 -4
  104. data/spec/test_data/v5.2/expected_daily_prophet_mailer.rbi +7 -0
  105. data/spec/test_data/v5.2/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  106. data/spec/test_data/v5.2/expected_hogwarts_acceptance_mailer.rbi +10 -0
  107. data/spec/test_data/v5.2/expected_spell_book.rbi +2 -2
  108. data/spec/test_data/v5.2/expected_wizard.rbi +342 -0
  109. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +342 -0
  110. data/spec/test_data/v6.0/expected_application_mailer.rbi +5 -0
  111. data/spec/test_data/v6.0/expected_attachment.rbi +4 -4
  112. data/spec/test_data/v6.0/expected_blob.rbi +28 -22
  113. data/spec/test_data/v6.0/expected_daily_prophet_mailer.rbi +7 -0
  114. data/spec/test_data/v6.0/expected_helpers_with_application_and_devise_helpers.rbi +29 -0
  115. data/spec/test_data/v6.0/expected_hogwarts_acceptance_mailer.rbi +10 -0
  116. data/spec/test_data/v6.0/expected_spell_book.rbi +2 -2
  117. data/spec/test_data/v6.0/expected_wizard.rbi +526 -16
  118. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +526 -16
  119. metadata +94 -1
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: false
2
2
  class CreateWands < ActiveRecord::Migration[5.1]
3
3
  def change
4
4
  create_table :wands do |t|
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: false
2
2
  class CreateSpellBooks < ActiveRecord::Migration[5.1]
3
3
  def change
4
4
  create_table :spell_books do |t|
@@ -1,4 +1,4 @@
1
- # typed: true
1
+ # typed: false
2
2
  class AddMoreColumnTypesToWands < ActiveRecord::Migration[5.1]
3
3
  def change
4
4
  add_column :wands, :flexibility, :float, null: false, default: 0.5
@@ -0,0 +1,6 @@
1
+ # typed: false
2
+ class AddBroomToWizard < ActiveRecord::Migration[5.1]
3
+ def change
4
+ add_column :wizards, :broom, :string
5
+ end
6
+ end
@@ -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: strict
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: 20190620000004) do
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.1)
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.4.0)
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.4663)
113
- sorbet-static (= 0.4.4663)
114
- sorbet-runtime (0.4.4663)
115
- sorbet-static (0.4.4663-universal-darwin-14)
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,9 @@
1
+ # typed: strong
2
+ class DailyProphetMailer < ApplicationMailer
3
+ extend T::Sig
4
+
5
+ sig { params(wizards: T::Array[Wizard], hotnews_only: T::Boolean).void }
6
+ def notify_subscribers(wizards:, hotnews_only:)
7
+ # TODO: mail the latest news to wizards!
8
+ end
9
+ end
@@ -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,6 @@
1
+ # typed: true
2
+ class AddBroomToWizard < ActiveRecord::Migration[5.2]
3
+ def change
4
+ add_column :wizards, :broom, :string
5
+ end
6
+ 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: strict
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: 2019_06_20_000004) do
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.1)
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.4.0)
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.4663)
128
- sorbet-static (= 0.4.4663)
129
- sorbet-runtime (0.4.4663)
130
- sorbet-static (0.4.4663-universal-darwin-14)
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,9 @@
1
+ # typed: strong
2
+ class DailyProphetMailer < ApplicationMailer
3
+ extend T::Sig
4
+
5
+ sig { params(wizards: T::Array[Wizard], hotnews_only: T::Boolean).void }
6
+ def notify_subscribers(wizards:, hotnews_only:)
7
+ # TODO: mail the latest news to wizards!
8
+ end
9
+ end
@@ -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: strict
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,6 @@
1
+ # typed: true
2
+ class AddBroomToWizard < ActiveRecord::Migration[6.0]
3
+ def change
4
+ add_column :wizards, :broom, :string
5
+ end
6
+ 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: 2019_06_20_000004) do
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,5 @@
1
+ # typed: strong
2
+ # This is an autogenerated file for Rails helpers.
3
+ # Please rerun rake rails_rbi:mailers to regenerate.
4
+ class ApplicationMailer
5
+ end
@@ -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