philiprehberger-assert 0.3.0 → 0.4.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: e39e8f2c580c51b62aee03496bca3941ac2efe839618a379e5a50721e2e2e0f1
4
- data.tar.gz: 1dd5e255316ff40587c86a795a098ca8d40aba63c3e8ba8505458b9a9455e3b2
3
+ metadata.gz: f5fea50ef7ac475426e9456b67e82f2be344f3b97fccba75f2e0d1fe944c1ae7
4
+ data.tar.gz: 5fd7d6aca18f9c06d4ace4a050483b433f014203252d2cd7a0b8fc4c8fdbf5a4
5
5
  SHA512:
6
- metadata.gz: 25bdfe4360a3d1619e7c0aeb7f7235c47b8cdac18c047ed14c6bbb5baad2b36ad546444f8e7a8b2c0eab814f2d6e3a101fbbec5472c4ed78dcdbb12f1f0456d9
7
- data.tar.gz: 02f70ca6912c4ac85b05d19ed44dcb4c53eb9e89c15752933c46fc2197884df3a74f3089c9ee714a596b30e8db7eeb77d23e35dd60008d1a020bb3b199cb7f9a
6
+ metadata.gz: 8ef0576d1e93ec43284b49a11668e1d3fc8412576ab96919a0fbc997c282c1626be2ba91f0fa6118f6b1f7ef6ca0ec1a467402d79113e476914d667d778355a0
7
+ data.tar.gz: 69aa855412b4409cea2b6071ab560919acee192daa546a4b5bbd18cf2d5a7938e3751ebd947a56dbaf0510f9780525e9791058cf970177799c3112ffa6ecfa6f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-04-15
11
+
12
+ ### Added
13
+ - `starts_with(prefix)` matcher for string prefix assertions
14
+ - `ends_with(suffix)` matcher for string suffix assertions
15
+
10
16
  ## [0.3.0] - 2026-04-04
11
17
 
12
18
  ### Added
data/README.md CHANGED
@@ -45,6 +45,13 @@ Philiprehberger::Assert.that(config).includes_key(:host)
45
45
  Philiprehberger::Assert.that(items).not_empty
46
46
  ```
47
47
 
48
+ ### String Prefix and Suffix
49
+
50
+ ```ruby
51
+ Assert.that('hello world').starts_with('hello')
52
+ Assert.that('hello world').ends_with('world')
53
+ ```
54
+
48
55
  ### Range and Membership
49
56
 
50
57
  ```ruby
@@ -98,6 +105,8 @@ Philiprehberger::Assert.precondition(user.active?, 'user must be active')
98
105
  | `Assertion#gt(num)` | Assert value > num |
99
106
  | `Assertion#lt(num)` | Assert value < num |
100
107
  | `Assertion#matches(pattern)` | Assert value matches regex pattern |
108
+ | `Assertion#starts_with(prefix)` | Assert string value starts with prefix |
109
+ | `Assertion#ends_with(suffix)` | Assert string value ends with suffix |
101
110
  | `Assertion#not_blank` | Assert value is not nil or blank |
102
111
  | `Assertion#not_empty` | Assert value is not empty |
103
112
  | `Assertion#includes_key(key)` | Assert hash includes key |
@@ -34,6 +34,14 @@ module Philiprehberger
34
34
  check(pattern.match?(@value.to_s), "Expected #{@value.inspect} to match #{pattern.inspect}")
35
35
  end
36
36
 
37
+ def starts_with(prefix)
38
+ check(@value.start_with?(prefix), "expected to start with #{prefix.inspect}")
39
+ end
40
+
41
+ def ends_with(suffix)
42
+ check(@value.end_with?(suffix), "expected to end with #{suffix.inspect}")
43
+ end
44
+
37
45
  def not_blank
38
46
  check(!@value.nil? && !@value.to_s.strip.empty?, 'Expected value to not be blank')
39
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module Assert
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philiprehberger-assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Rehberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-05 00:00:00.000000000 Z
11
+ date: 2026-04-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A lightweight runtime assertion library for Ruby with chainable matchers,
14
14
  soft assertions, and Design by Contract preconditions.