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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +9 -0
- data/lib/philiprehberger/assert/assertion.rb +8 -0
- data/lib/philiprehberger/assert/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f5fea50ef7ac475426e9456b67e82f2be344f3b97fccba75f2e0d1fe944c1ae7
|
|
4
|
+
data.tar.gz: 5fd7d6aca18f9c06d4ace4a050483b433f014203252d2cd7a0b8fc4c8fdbf5a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
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.
|
|
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-
|
|
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.
|