tapioca 0.14.0 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 469c53709eb6cb5de25abc9526d40c8dff3b852bf218bcbbc966078271754bfd
4
- data.tar.gz: fbc47526d02ef8fea90ad262007865ee56ab56a72dc5832c375540f42a3d9e11
3
+ metadata.gz: 3f8cfe1d421099c152f602f65792f694adf8a880014589ff23dc16547c60897d
4
+ data.tar.gz: c941e055640e4ef5caf4a26ed50268908fce7098b51c4423144615e04295f6a1
5
5
  SHA512:
6
- metadata.gz: f64c8009bf0e0d5a4b11595cc0bf9c72c5aca3fee4bcae7da5b036009dc0e27c9c5fc2d921564f9664aef0f2b1a648000e3228902d3d2a8b13338af85773d48e
7
- data.tar.gz: b751f2a0618927d616edebad5841333af85cb5c7d773bd8904c119d521ab871a65b3405c72efe56426faccdada8b32204f2e5a56cde3ddc4f067884270f106b4
6
+ metadata.gz: 3d6522f57d604948443018620f625859e8676ddd2978a6e2c6b9252ee39a055526a1fe7dd3ff76f3ed330e3c00f9580fed5ef2fb4a86fdb87c572007f1b43297
7
+ data.tar.gz: f1e3c8fbfcfe728906c76b55d8f89762d3e55178c5d89631af7161296b7bb117e3b64bc0b8b03c31ca36cb0181b4b0b3eaede640c54fd1312daacb8ec35f6b4a
@@ -127,7 +127,7 @@ module Tapioca
127
127
  error_handler: ->(error) {
128
128
  say_error(error, :bold, :red)
129
129
  },
130
- skipped_constants: constantize(@skip_constant),
130
+ skipped_constants: constantize(@skip_constant, ignore_missing: true),
131
131
  number_of_workers: @number_of_workers,
132
132
  )
133
133
  end
@@ -26,10 +26,11 @@ module Tapioca
26
26
  # # test_case.rbi
27
27
  # # typed: true
28
28
  # class ActiveSupport::TestCase
29
+ # sig { params(fixture_name: NilClass, other_fixtures: NilClass).returns(T::Array[Post]) }
29
30
  # sig { params(fixture_name: T.any(String, Symbol), other_fixtures: NilClass).returns(Post) }
30
31
  # sig { params(fixture_name: T.any(String, Symbol), other_fixtures: T.any(String, Symbol))
31
32
  # .returns(T::Array[Post]) }
32
- # def posts(fixture_name, *other_fixtures); end
33
+ # def posts(fixture_name = nil, *other_fixtures); end
33
34
  # end
34
35
  # ~~~
35
36
  class ActiveRecordFixtures < Compiler
@@ -110,9 +111,15 @@ module Tapioca
110
111
  def create_fixture_method(mod, name)
111
112
  return_type = return_type_for_fixture(name)
112
113
  mod << RBI::Method.new(name) do |node|
113
- node.add_param("fixture_name")
114
+ node.add_opt_param("fixture_name", "nil")
114
115
  node.add_rest_param("other_fixtures")
115
116
 
117
+ node.add_sig do |sig|
118
+ sig.add_param("fixture_name", "NilClass")
119
+ sig.add_param("other_fixtures", "NilClass")
120
+ sig.return_type = "T::Array[#{return_type}]"
121
+ end
122
+
116
123
  node.add_sig do |sig|
117
124
  sig.add_param("fixture_name", "T.any(String, Symbol)")
118
125
  sig.add_param("other_fixtures", "NilClass")
@@ -102,6 +102,10 @@ module Tapioca
102
102
  def gather_constants
103
103
  return [] unless defined?(Rails.application) && Rails.application
104
104
 
105
+ # Load routes if they haven't been loaded yet (see https://github.com/rails/rails/pull/51614).
106
+ routes_reloader = Rails.application.routes_reloader
107
+ routes_reloader.execute_unless_loaded if routes_reloader&.respond_to?(:execute_unless_loaded)
108
+
105
109
  Object.const_set(:GeneratedUrlHelpersModule, Rails.application.routes.named_routes.url_helpers_module)
106
110
  Object.const_set(:GeneratedPathHelpersModule, Rails.application.routes.named_routes.path_helpers_module)
107
111
 
@@ -19,32 +19,32 @@ module Tapioca
19
19
  super
20
20
  end
21
21
 
22
- def kredis_string(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
22
+ def kredis_string(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
23
23
  collect_kredis_type(name, "Kredis::Types::Scalar")
24
24
  super
25
25
  end
26
26
 
27
- def kredis_integer(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
27
+ def kredis_integer(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
28
28
  collect_kredis_type(name, "Kredis::Types::Scalar")
29
29
  super
30
30
  end
31
31
 
32
- def kredis_decimal(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
32
+ def kredis_decimal(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
33
33
  collect_kredis_type(name, "Kredis::Types::Scalar")
34
34
  super
35
35
  end
36
36
 
37
- def kredis_datetime(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
37
+ def kredis_datetime(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
38
38
  collect_kredis_type(name, "Kredis::Types::Scalar")
39
39
  super
40
40
  end
41
41
 
42
- def kredis_flag(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
42
+ def kredis_flag(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
43
43
  collect_kredis_type(name, "Kredis::Types::Flag")
44
44
  super
45
45
  end
46
46
 
47
- def kredis_float(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
47
+ def kredis_float(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
48
48
  collect_kredis_type(name, "Kredis::Types::Scalar")
49
49
  super
50
50
  end
@@ -54,22 +54,23 @@ module Tapioca
54
54
  super
55
55
  end
56
56
 
57
- def kredis_json(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
57
+ def kredis_json(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
58
58
  collect_kredis_type(name, "Kredis::Types::Scalar")
59
59
  super
60
60
  end
61
61
 
62
- def kredis_list(name, key: nil, typed: :string, config: :shared, after_change: nil)
62
+ def kredis_list(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
63
63
  collect_kredis_type(name, "Kredis::Types::List")
64
64
  super
65
65
  end
66
66
 
67
- def kredis_unique_list(name, limit: nil, key: nil, typed: :string, config: :shared, after_change: nil)
67
+ def kredis_unique_list(name, limit: nil, key: nil, default: nil, typed: :string, config: :shared,
68
+ after_change: nil)
68
69
  collect_kredis_type(name, "Kredis::Types::UniqueList")
69
70
  super
70
71
  end
71
72
 
72
- def kredis_set(name, key: nil, typed: :string, config: :shared, after_change: nil)
73
+ def kredis_set(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
73
74
  collect_kredis_type(name, "Kredis::Types::Set")
74
75
  super
75
76
  end
@@ -84,17 +85,17 @@ module Tapioca
84
85
  super
85
86
  end
86
87
 
87
- def kredis_counter(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
88
+ def kredis_counter(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
88
89
  collect_kredis_type(name, "Kredis::Types::Counter")
89
90
  super
90
91
  end
91
92
 
92
- def kredis_hash(name, key: nil, typed: :string, config: :shared, after_change: nil)
93
+ def kredis_hash(name, key: nil, default: nil, typed: :string, config: :shared, after_change: nil)
93
94
  collect_kredis_type(name, "Kredis::Types::Hash")
94
95
  super
95
96
  end
96
97
 
97
- def kredis_boolean(name, key: nil, config: :shared, after_change: nil, expires_in: nil)
98
+ def kredis_boolean(name, key: nil, default: nil, config: :shared, after_change: nil, expires_in: nil)
98
99
  collect_kredis_type(name, "Kredis::Types::Scalar")
99
100
  super
100
101
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.14.0"
5
+ VERSION = "0.14.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2024-05-07 00:00:00.000000000 Z
14
+ date: 2024-05-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler