easytest 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26a4c476cdf2c4908802c951c61bbeaeb898268e28a8c6e744287c513bb8ae9
4
- data.tar.gz: 14d1f823c3a2edc1453fa7dbabee290bd5f815a8d79bbc87ad1415a4cc8d678a
3
+ metadata.gz: 8a540d5ea75dc9b2061c200bd9bdce35d807dd8bdc6430b78de5690468832942
4
+ data.tar.gz: 9165f6c8d0852a4fe6c3d12be43a86587331bcb6dc17dc230c023831c405a0d9
5
5
  SHA512:
6
- metadata.gz: 030a29f7f9aa8439bd65e3f36e028c89fd1df6553ba7f523fc50f9b830663cf01a87b43548e95b8b19470b7333939fb25707f189904358253024bfcf0c409301
7
- data.tar.gz: 57281afe652b63dd426dd3432cced11f94403f9b2df3d17b7a4d2a537f884ead3f1d20044c64e984abd72ce1dbb8cdf4a995fc2333bea7f1c80f30ed23bf7a94
6
+ metadata.gz: 4fadc88c8be0d6ea331597a32ff3110df8adfb72ef48ea7eb27c7d50585cb1f399a4dedfcdd7cad838020d1e877ed96defbf263a506aaf9212868f4b226deb4c
7
+ data.tar.gz: 2f2ae0a7f25c0584d8f467e224117f0276e961075825ad151364555ce9ec8b15150b5c428021063c266217955823547e63e672b1acf2917d23ba90bd8963e289
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.12.0
6
+
7
+ - Drop Ruby 3.1 support due to EOL (March 2025).
8
+ - Fix Ruby 4.0 compatibility for `caller_locations`.
9
+
5
10
  ## 0.11.0
6
11
 
7
12
  - Drop Ruby 3.0 support due to EOL (April 2024).
data/lib/easytest/case.rb CHANGED
@@ -11,7 +11,7 @@ module Easytest
11
11
 
12
12
  def initialize(name:, skipped: false, only: false, block: nil)
13
13
  @name = name
14
- @file = (caller_locations(3, 1)&.first&.absolute_path or raise)
14
+ @file = Utils.find_caller_file
15
15
  @block = block
16
16
  @skipped = skipped
17
17
  @only = only
data/lib/easytest/hook.rb CHANGED
@@ -7,7 +7,7 @@ module Easytest
7
7
  def initialize(type:, block:)
8
8
  raise ArgumentError, "" unless [:before, :after].include?(type)
9
9
 
10
- @file = (caller_locations(3, 1)&.first&.absolute_path or raise)
10
+ @file = Utils.find_caller_file
11
11
  @type = type
12
12
  @block = block
13
13
  end
@@ -24,5 +24,16 @@ module Easytest
24
24
  def indent_text(text, indent_string)
25
25
  text.gsub(/^(.+)/, "#{indent_string}\\1")
26
26
  end
27
+
28
+ def find_caller_file
29
+ # Ruby 4.0 has a shorter call stack than 3.4, so we search for the first
30
+ # caller location that's outside the easytest library itself
31
+ lib_dir = File.expand_path("..", __dir__.to_s)
32
+ caller_locations&.each do |loc|
33
+ loc_path = loc.absolute_path
34
+ return loc_path if loc_path && !loc_path.start_with?(lib_dir)
35
+ end
36
+ raise "Failed to find caller file in: #{caller_locations&.first || '<no callers>'}"
37
+ end
27
38
  end
28
39
  end
@@ -1,3 +1,3 @@
1
1
  module Easytest
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
data/sig/easytest.rbs CHANGED
@@ -22,7 +22,7 @@ module Easytest
22
22
 
23
23
  # Expect the given object or block to satisfy some criterion.
24
24
  def expect: (untyped actual) -> Easytest::Expectation
25
- | { () -> void } -> Easytest::Expectation
25
+ | () { () -> void } -> Easytest::Expectation
26
26
  end
27
27
 
28
28
  # An expectation in test cases.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easytest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masafumi Koba
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: listen
@@ -87,7 +86,6 @@ metadata:
87
86
  source_code_uri: https://github.com/ybiquitous/easytest
88
87
  changelog_uri: https://github.com/ybiquitous/easytest/blob/main/CHANGELOG.md
89
88
  rubygems_mfa_required: 'true'
90
- post_install_message:
91
89
  rdoc_options: []
92
90
  require_paths:
93
91
  - lib
@@ -95,15 +93,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
93
  requirements:
96
94
  - - ">="
97
95
  - !ruby/object:Gem::Version
98
- version: '3.1'
96
+ version: '3.2'
99
97
  required_rubygems_version: !ruby/object:Gem::Requirement
100
98
  requirements:
101
99
  - - ">="
102
100
  - !ruby/object:Gem::Version
103
101
  version: '0'
104
102
  requirements: []
105
- rubygems_version: 3.5.9
106
- signing_key:
103
+ rubygems_version: 4.0.16
107
104
  specification_version: 4
108
105
  summary: Easy testing for Ruby.
109
106
  test_files: []