rspec-sorbet-types 0.2.0 → 0.3.0

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: 0a7aad04bb14c8b0395761208a5b0b6aa51b0071b36679e3a4bf34a3bb9c44fd
4
- data.tar.gz: 88a758547e500814bb01421eb429bb58bbb312e04e7a0299395986a2f69a56a4
3
+ metadata.gz: 38115893c2185828951d0b6afce7710c0a9999999a6abec57496f1e97a9723b9
4
+ data.tar.gz: e9fb71bee0b47caae7500716f2e3c45d888e010607272a520c92916391a2bce6
5
5
  SHA512:
6
- metadata.gz: 95cb0d8253344e04e5fa9f806820f3a0948b85a4ff78419a295ba867403bf41edea391607cff76e2d82d4cb1f9e241c98e53e5f0318b588561f74ab991938c45
7
- data.tar.gz: 131281f1685c584a030220d05320ca5e9d81e339eb1dfc98b7bb577eb9b1efaf7a549b59ea8c05246f7d05076d29232de98dcb8f1ea8efa3d2f3a7076e72b3ff
6
+ metadata.gz: 99b1a3ee08b1a3b24d1c04c6e2349c00ee8005eb88de4e58546b8fc77b607278fa2aadb7e1fed4b9c7d03253703591c11b3dbb767de0d52eae225484c39a6b4d
7
+ data.tar.gz: 27af9e068c9ff987364d5bb8d65aaf43e35af38651520d6a4a426d9defe0a94677a1e4d0c42a023ce441f4262b389904673297add2ba93ae67192a1e83c37cff
@@ -1,9 +1,10 @@
1
- # typed: true
1
+ # frozen_string_literal: true
2
+ # typed: strict
2
3
 
3
4
  module RSpec
4
5
  module Sorbet
5
6
  module Types
6
- VERSION_STRING = "0.2.0"
7
+ VERSION_STRING = "0.3.0"
7
8
  end
8
9
  end
9
10
  end
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
1
4
  require "sorbet-runtime"
2
5
  require_relative "types/sig"
3
6
  require_relative "types/version"
@@ -21,16 +21,31 @@ module Tapioca
21
21
 
22
22
  private
23
23
 
24
+ sig { void }
25
+ def add_spec_dir_to_load_path!
26
+ $LOAD_PATH.unshift(spec_dir)
27
+ end
28
+
24
29
  sig { void }
25
30
  def require_spec_files!
26
- Dir.glob(spec_glob).each do |file|
27
- require(file)
31
+ Dir.glob(spec_glob, base: spec_dir).each do |path|
32
+ require(strip_rb_suffix(path))
28
33
  end
29
34
  end
30
35
 
36
+ sig { returns(String) }
37
+ def spec_dir
38
+ ENV["SORBET_RSPEC_DIR"] || File.join(Dir.pwd, "spec")
39
+ end
40
+
31
41
  sig { returns(String) }
32
42
  def spec_glob
33
- ENV["SORBET_RSPEC_GLOB"] || File.join(".", "spec", "**", "*.rb")
43
+ ENV["SORBET_RSPEC_GLOB"] || File.join("**", "*.rb")
44
+ end
45
+
46
+ sig { params(path: T.any(String, Pathname)).returns(String) }
47
+ def strip_rb_suffix(path)
48
+ path.sub(/\.rb$/, "").to_s
34
49
  end
35
50
  end
36
51
 
@@ -38,6 +53,7 @@ module Tapioca
38
53
  ENV["SORBET_RSPEC_TYPES_COMPILING"] = "1"
39
54
 
40
55
  # Load all spec files during compiler definition
56
+ add_spec_dir_to_load_path!
41
57
  require_spec_files!
42
58
 
43
59
  sig { override.void }
data/rbi/rspec-core.rbi CHANGED
@@ -6,11 +6,11 @@ module RSpec
6
6
  sig do
7
7
  params(
8
8
  args: T.untyped,
9
- example_group_block: T.proc.bind(T.class_of(RSpec::Core::ExampleGroup)).void,
9
+ example_group_block: T.proc.bind(T.class_of(RSpec::Core::ExampleGroup)).void
10
10
  ).void
11
11
  end
12
-
13
- def describe(*args, &example_group_block); end
12
+ def describe(*args, &example_group_block)
13
+ end
14
14
  end
15
15
  end
16
16
 
@@ -22,46 +22,46 @@ class RSpec::Core::ExampleGroup
22
22
  sig do
23
23
  params(
24
24
  all_args: T.untyped,
25
- block: T.proc.bind(RSpec::Core::ExampleGroup).void,
25
+ block: T.proc.bind(RSpec::Core::ExampleGroup).void
26
26
  ).void
27
27
  end
28
-
29
- def it(*all_args, &block); end
28
+ def it(*all_args, &block)
29
+ end
30
30
 
31
31
  sig do
32
32
  params(
33
33
  all_args: T.untyped,
34
- block: T.proc.bind(RSpec::Core::ExampleGroup).void,
34
+ block: T.proc.bind(RSpec::Core::ExampleGroup).void
35
35
  ).void
36
36
  end
37
-
38
- def specify(*all_args, &block); end
37
+ def specify(*all_args, &block)
38
+ end
39
39
 
40
40
  sig do
41
41
  params(
42
42
  args: T.untyped,
43
- block: T.proc.bind(RSpec::Core::ExampleGroup).void,
43
+ block: T.proc.bind(RSpec::Core::ExampleGroup).void
44
44
  ).void
45
45
  end
46
-
47
- def before(*args, &block); end
46
+ def before(*args, &block)
47
+ end
48
48
 
49
49
  sig do
50
50
  params(
51
51
  args: T.untyped,
52
- block: T.proc.bind(RSpec::Core::ExampleGroup).void,
52
+ block: T.proc.bind(RSpec::Core::ExampleGroup).void
53
53
  ).void
54
54
  end
55
-
56
- def after(*args, &block); end
55
+ def after(*args, &block)
56
+ end
57
57
 
58
58
  sig do
59
59
  params(
60
60
  args: T.untyped,
61
- block: T.proc.bind(RSpec::Core::ExampleGroup).void,
61
+ block: T.proc.bind(RSpec::Core::ExampleGroup).void
62
62
  ).void
63
63
  end
64
-
65
- def around(*args, &block); end
64
+ def around(*args, &block)
65
+ end
66
66
  end
67
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sorbet-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hongli Lai