easytest 0.10.1 → 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: 8e036b68f05b438dfcb392f448b5aab8b0a9ac37ac2b8790d92efff25fa9b7c2
4
- data.tar.gz: eb28cb3da178c9391231f19303f075c1d6bd3e30922f5324b44603abf715e1e2
3
+ metadata.gz: 8a540d5ea75dc9b2061c200bd9bdce35d807dd8bdc6430b78de5690468832942
4
+ data.tar.gz: 9165f6c8d0852a4fe6c3d12be43a86587331bcb6dc17dc230c023831c405a0d9
5
5
  SHA512:
6
- metadata.gz: 8777f94dd6f3133c041e54c12fe716e06f039584b5ab8f12f050e02b3241598e610ec0106cf793875e2cefa9f0e2e8020dc34929fef000099e50b3da7dfe6fb8
7
- data.tar.gz: b192eb934a13acd0aa6302bd115582a7126e8b386927aaac501eb65c448cd1e2eed4451b536b0822f7334f57a4cf5e142b3e0ffcbc05165335ba4311d23e7a1c
6
+ metadata.gz: 4fadc88c8be0d6ea331597a32ff3110df8adfb72ef48ea7eb27c7d50585cb1f399a4dedfcdd7cad838020d1e877ed96defbf263a506aaf9212868f4b226deb4c
7
+ data.tar.gz: 2f2ae0a7f25c0584d8f467e224117f0276e961075825ad151364555ce9ec8b15150b5c428021063c266217955823547e63e672b1acf2917d23ba90bd8963e289
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
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
+
10
+ ## 0.11.0
11
+
12
+ - Drop Ruby 3.0 support due to EOL (April 2024).
13
+
5
14
  ## 0.10.1
6
15
 
7
16
  - No actual changes. Just switch to a new simplified release workflow.
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/dsl.rb CHANGED
@@ -23,8 +23,8 @@ module Easytest
23
23
  Easytest.add_case Case.new(name: name, only: true, block: block)
24
24
  end
25
25
 
26
- def expect(actual = nil, &block)
27
- Expectation.new(actual, &block)
26
+ def expect(actual = nil, &)
27
+ Expectation.new(actual, &)
28
28
  end
29
29
  end
30
30
  end
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.10.1"
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.
@@ -71,7 +71,7 @@ module Easytest
71
71
  def to_have_attributes: (**untyped expected) -> void
72
72
 
73
73
  # Expect to satisfy a condition that the given block returns `true`.
74
- def to_satisfy: () { (untyped actual) -> bool } -> void
74
+ def to_satisfy: () { (untyped actual) -> boolish } -> void
75
75
 
76
76
  # Expect to raise the given exception or an exception with the given message.
77
77
  def to_raise: (Class expected, ?(String | Regexp)? with_message) -> void
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.10.1
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: 2023-12-14 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.0'
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.4.10
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: []